Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Query Doubt!!

Author  Topic 

S_Lakshmi
Starting Member

22 Posts

Posted - 2008-06-13 : 10:02:27
Hi,

I just execute the following statement

Delete top 1 from <table name>

it is giving the error "incorrect syntax near 1"


But this statement is working fine .

Delete top (1) from <table name>


What is the differance between these statements..?

Can any can explian me..


Thanks
Lakshmi.S

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-13 : 10:17:07
Delete Top ........ is introduced in SQL Server 2005. So you need to use braces around the number

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

S_Lakshmi
Starting Member

22 Posts

Posted - 2008-06-13 : 10:29:12
quote:
Originally posted by madhivanan

Delete Top ........ is introduced in SQL Server 2005. So you need to use braces around the number

Madhivanan

Failing to plan is Planning to fail




Could you explian little bit more? It means the newly intorduced querys should use braces in MS SQl 2005.


Lakshmi.S
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-13 : 10:49:15
quote:
Originally posted by S_Lakshmi

quote:
Originally posted by madhivanan

Delete Top ........ is introduced in SQL Server 2005. So you need to use braces around the number

Madhivanan

Failing to plan is Planning to fail




Could you explian little bit more? It means the newly intorduced querys should use braces in MS SQl 2005.


Lakshmi.S


Look at syntax of DELETE statement in books online and you will see why () is required

http://msdn.microsoft.com/en-us/library/ms189835.aspx
Go to Top of Page
   

- Advertisement -