Inserting Only time into SQL db
-
Hello, I want to insert only time into SQL. I have datetime field in database & also have taken datetime picker (ew) on the page. How it can be done? Please help me.. Thanx.. :)
-
Hello, I want to insert only time into SQL. I have datetime field in database & also have taken datetime picker (ew) on the page. How it can be done? Please help me.. Thanx.. :)
I'm not sure if there's a time field in SQL. If there's not, just set the date to always be the same, and ignore it and only use the time portion.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Hello, I want to insert only time into SQL. I have datetime field in database & also have taken datetime picker (ew) on the page. How it can be done? Please help me.. Thanx.. :)
deepseeindeepsy wrote:
I want to insert only time into SQL
You don't have to do that. Use
datetime
only and when you read, use the functions provided by SQL server to get only time.Best wishes, Navaneeth
-
deepseeindeepsy wrote:
I want to insert only time into SQL
You don't have to do that. Use
datetime
only and when you read, use the functions provided by SQL server to get only time.Best wishes, Navaneeth
Sir, Which functions to use ? If I inserted it using nvarchar field in db, then its OK & done bt Will it affect when working on report making? Thanx.. :)
-
Sir, Which functions to use ? If I inserted it using nvarchar field in db, then its OK & done bt Will it affect when working on report making? Thanx.. :)
deepseeindeepsy wrote:
If I inserted it using nvarchar field in db
That would be utterly retarded, because you'd lose the ability to work with it as a time. This was my first google hit[^]. Was that so hard ? You can return just the time portion as a string from a datetime in the database, which is what was being suggested, use the functions in SQL Server to get back just the time, even if you store a datetime.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
I'm not sure if there's a time field in SQL. If there's not, just set the date to always be the same, and ignore it and only use the time portion.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Sir, I used the timepicker from EW & have written the statement as objData.AddParameter("InTime", tpInTime.SelectedTime); Here, tpInTime.SelectedTime has datetime as return value which is same in db. Even its not fare. Thanx Sir. :)
-
Hello, I want to insert only time into SQL. I have datetime field in database & also have taken datetime picker (ew) on the page. How it can be done? Please help me.. Thanx.. :)
In SQL Server 2008, there is Time Data Type so that you can insert only time value there.