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)
 Problem in insert query

Author  Topic 

soni321
Starting Member

8 Posts

Posted - 2011-04-21 : 14:36:17
insert into orders (onum,amt,odate,cnum,snum)
select (3001,18.69,'10/03/1990',1007)
Union All
select (3003,767.19,'10/03/1990',2001,1001)
union All
select (3002,1900.10,'10/03/1990',2007,1004)
union All
Select (3005,5160.45,'10/3,1990',2003,1002)
union All
select (3006,1098.16,'10/3/1990',2008,1007)
union All
select(3009,1713.23,'10/04/1990',2002,1003)
union All
select (3007,75.75,'10/04/1990',2004,1002)
union All
select (3008,4723.00,'10/05/1990',2006,1002)
union All
Select(3010,1309.95,'10/06/1990',2004,1002)
union All
select(3011,9891.88,'10/06/1990',2006,1001);

it give this output when i run it
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Line 6
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Line 8
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Line 10
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Line 12
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Line 14
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Line 16
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Line 18
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Line 20
Incorrect syntax near ','.



Bhupinder Dhatt

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-04-21 : 14:43:12
select 3001,18.69,'10/03/1990',1007

remove the brackets from the select statements


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

soni321
Starting Member

8 Posts

Posted - 2011-04-21 : 15:03:43
sir now it shows error
Msg 208, Level 16, State 1, Line 1
Invalid object name 'orders'.


Bhupinder Dhatt
Go to Top of Page
   

- Advertisement -