RLLewis
asked on
what's the best way to concatenate this date?
Hi. I'm looking to get a datetime concatenated value from my table -- this is probably quite easy, but I'm not getting what I want.
this gives me this: 20050320
select convert(varchar(12),getdat e(), 112)
what's the right way to return this: 20050320.14:23:53.140
this gives me this: 20050320
select convert(varchar(12),getdat
what's the right way to return this: 20050320.14:23:53.140
ASKER
nope - syntactically incorrect. i added the missing paren after the first getdate(), 112), but now I'm getting this error:
Syntax error converting the varchar value 'Mar 20 2005 2:49PM' to a column of data type int.
select (convert(varchar(12),getda te(), 112)) + '.' + right (cast(getdate() as varchar(50)), len(cast(getdate() as varchar(50)) - 11))
this gets me this: 20050320. 2:48PM
select (convert(varchar(12),getda te(), 112)) + '.' + RIGHT(CONVERT(VARCHAR(30), getdate(), 100), 7)
but I don't want the time in that format. any ideas?
Syntax error converting the varchar value 'Mar 20 2005 2:49PM' to a column of data type int.
select (convert(varchar(12),getda
this gets me this: 20050320. 2:48PM
select (convert(varchar(12),getda
but I don't want the time in that format. any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
perfect. thank you
select (convert(varchar(12),getda