SELECT @time = TO_CHAR(@theDate, 'MM/DD/YYYY HH:MMS')
This is a conversion statement that we use currently in Oracle. I need to do this same function in Sql server. I have seen the options of cast and convert but they dont have anything is this exact format. Thanks again for all help.
Here is a little piece of code that I use to remember the formats and how to put them together as nigelrivett did to get meet your needs
set nocount on
declare @dt as datetime
declare @i as tinyint
set @dt = getdate()
set @i = 0
print 'Code|' + space(36) + 'Code|'
while @i < 22 begin
print convert(char(3),@i) + ' | '
+ convert(char(3),(100+@i)) + ' | '
set @i = @i+1
if (@i = 15) set @i = 20