What is the code to create a table having a column named DATE, which takes date in the format dd/mm/yyyy, in SQL Server2000? Or any format of date.

Questions by rajivkapoor

Showing Answers 1 - 3 of 3 Answers

sudal2000

  • Jun 12th, 2006
 

hai,

          using this query you can take as you like,

           select convert(varchar,DATE,107) from tablename

            DATE->one of the column is availabe in table which is created by you

  Was this answer useful?  Yes

rick

  • Jun 24th, 2006
 

CREATE TABLE mytable ([Date] SMALLDATETIME)

  Was this answer useful?  Yes

Yogesh Srivastava

  • Jun 27th, 2006
 

Hi

Your can try this

SELECT  CONVERT(varchar, GETDATE(), 103)

In this example the GETDATE() will return your sql server system date.

and  the CONVERT is used to convert the date into the desired fomat.

Basically the CONVERT requires three arguments

1. Datatype

2. Date to Convert

3. Format style

Here is the list of style .....

Style ID

Style Type

0 or 100 mon dd yyyy hh:miAM (or PM)
101mm/dd/yy
102yy.mm.dd
103dd/mm/yy
104dd.mm.yy
105dd-mm-yy
106dd mon yy
107Mon dd, yy
108hh:mm:ss
9 or 109 mon dd yyyy hh:mi:ss:mmmAM (or PM)
110mm-dd-yy
111yy/mm/dd
112yymmdd
13 or 113 dd mon yyyy hh:mm:ss:mmm(24h)
114hh:mi:ss:mmm(24h)
20 or 120 yyyy-mm-dd hh:mi:ss(24h)
21 or 121 yyyy-mm-dd hh:mi:ss.mmm(24h)
126yyyy-mm-dd Thh:mm:ss.mmm(no spaces)
130dd mon yyyy hh:mi:ss:mmmAM
131dd/mm/yy hh:mi:ss:mmmAM

Enjoy the Code...

Hope this will help u

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions