Re: time
From: Hari Prasad (hari_prasad_k_at_hotmail.com)
Date: 07/26/04
- Next message: kk: "Count(*) and Like"
- Previous message: sara: "time"
- In reply to: sara: "time"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 26 Jul 2004 15:30:55 +0530
Hi,
You have to use the datatype "DATETIME" to store Date and Time. There is no
data type in SQL server which stores the time only. You can define the
column as DATETIME and while displaying you can use the CONVERT functions
and display the time only.
Sample:-
declare @k datetime
set @k=getdate()
select convert(char,@k,108)
Timestamp:-
Timestamp is not meant to store the time. It is used for version stamping
tables and will be unique inside a database. It is actually a automatically
generated binary value.
Note:-
The Transact-SQL timestamp data type is not the same as the timestamp data
type defined in the SQL-92 standard. The SQL-92 timestamp data type is
equivalent to the Transact-SQL datetime data type.
Thanks
Hari
MCDBA
"sara" <anonymous@discussions.microsoft.com> wrote in message
news:3b7f01c4725f$a8376a00$a501280a@phx.gbl...
> Hi
> i am new in mssql7.before i am using sybase and
> some of the tables having field type time.after
> convert to mssql7 i changed that field type as timestamp.
> i want to store time in that feild.For select and update
> query there was no prbm in sybase, but here it is showing
> error"The columns data type (columnname)requires the use
> of an embedded stmt" and while updating also error is
> coming,how can i solve this and store time in table.Please
> help
> thanks
- Next message: kk: "Count(*) and Like"
- Previous message: sara: "time"
- In reply to: sara: "time"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|