January 28, 2014 at 4:36 pm
I want something like this:
DECLARE @datetime DATETIME;
SET @datetime = Getdate();
Except in the form of:
2014-01-28 18:35:25
or something with the date and time.
January 28, 2014 at 5:17 pm
To display it, you need to use CONVERT with format code 120.
You should, however, store datetime values as datetype types which have no format predefined.
January 28, 2014 at 5:49 pm
Is this how you would do it?
DECLARE @datetime DATETIME;
SET @datetime = Getdate();
CONVERT (datetime , 120);
January 28, 2014 at 5:56 pm
Have you tried it?
It might not return the expected results because you're not including your variable in the function.
January 28, 2014 at 6:06 pm
Sorry,
Will this work:
DECLARE @datetime DATETIME;
SET @datetime = Getdate();
CONVERT (@datetime , 120);
January 28, 2014 at 6:12 pm
Now you're not including the target data type. Have you opened the link I provided?
And you are missing the SELECT statement.
Tip: If you select a function and press F1, you'll get immediately to the help article on that item.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply