quote:I am afraid I am still not following what you are asking. Is the space between the date part and the time part the issue? If that is the case, modify the query like this:
Originally posted by kalyan.cse05
I think you did not get my query.
However let me explain the same again.
I need to create a text file and for that need to make some entries in the fields of a table and based on the entries of the field the text file will be created.
Now I have a field in the table named "Suffix". If i enter "yyyymmdd" in the field "Sufix" then my text file has been created with name "test20120515". I am able to do that. But i need the time as suffix of that file also.[for example: "test20120515035218"]. So my query is what should i enter in the field "Sufix" so that timestamp has also been added as a suffix of the text file. for you information I have tried with "yyyymmdd hhmmss". But no success. :(.
Thanks in advance for your help.
kalyan Ashis Dey
REPLACE(REPLACE(REPLACE(CONVERT (VARCHAR(32),GETDATE(),120),'-',''),':',''),' ','')That, of course, takes the current time and formats it in the way you described. If it is some other timestamp that you need to convert, you would replace the GETDATE() with whatever timestamp you wish to use. For example:
DECLARE @myTime DATETIME;
SET @myTime = '2012-04-11 16:23:57.090'
SELECT REPLACE(REPLACE(REPLACE(CONVERT (VARCHAR(32),@myTime,120),'-',''),':',''),' ','');