How to create date in SQL Server 2000

30 pts.
Tags:
Display Attribute
SQL Query
SQL Server 2000 Database
SQL tables
I created a table with attribute date and i want to store date as "Date-Month-year". What procedure to create a date and how we able to insert the required format by using SQL Server 2000?

Software/Hardware used:
sql server 2000

Answer Wiki

Thanks. We'll let you know when a new response is added.

Use the DATETIME datatype. This will store the value in a universal format. You then simple control the display format from your application. And if you want to make change from your procedure just use following:

SELECT CONVERT(VARCHAR(8), GETDATE(), 5) AS [DD-MM-YY]

You can give datetime column name in place of GETDATE()

———

You can’t control the format in which dates are stored in the database. You can only control the way they are displayed.

To insert into a datetime column you need to enclose the values in single quotes.

You might want to take a look at this article: Working with SQL Server Date/Time Variables.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Malikjavediqbal
    insert into member(3,'jack','que',06-01-1985) i use datetime data type . it gives invalid input error . plz explain how to insert date .
    30 pointsBadges:
    report
  • Malikjavediqbal
    [...] Malikjavediqbal was wondering how to create a date in SQL Server 2000, and Carlosdl, Mr. Denny and NetDeveloper came to his [...]
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following