Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

SYSDATE in MS-SQL

Posted on 2003-03-24
2
Medium Priority
?
5,929 Views
Last Modified: 2008-02-01
Hi, I am new to SQL...Could some one please tell me how I can make this statement work in MS-SQL...It works fine in Oracle...

INSERT INTO Orders (Id, CustomerID, DateOrdered, DateSupplied) VALUES (6097,  1006, sysdate - 118,  sysdate - 98);

The error I get is ...The name 'sysdate' is not permitted in this context...does MS-SQL recocnise SYSDATE?

Cheers


0
Comment
Question by:baz_can_fix_it
2 Comments
 
LVL 32

Accepted Solution

by:
Brendt Hess earned 200 total points
ID: 8199412
The SQL Server equivalent of SysDate is GetDate():

INSERT INTO Orders (Id, CustomerID, DateOrdered, DateSupplied) VALUES (6097,  1006, GetDate() - 118,  GetDate() - 98)

0
 
LVL 1

Author Comment

by:baz_can_fix_it
ID: 8199435
Thank you bhess1 that worked :) cheers
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question