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.
| Author |
Topic |
|
swathigardas
Posting Yak Master
149 Posts |
Posted - 2008-09-04 : 04:53:34
|
| Hi, I have two tables one , two.When i'm running the below insert querycreate table one (id int default 0, name varchar(10))create table two (id,name varchar(10))insert into two values ('hema',2)insert into one select default,name from two where id=2The following Error is Shown-Msg 156, Level 15, State 1, Line 1Incorrect syntax near the keyword 'default'.Please help me out on this |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-04 : 05:26:04
|
No need of using default there. just use belowinsert into one (name)select name from two where id=2 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-04 : 05:33:37
|
| insert into one(name) select name from two where id=2MadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-04 : 05:34:14
|
Too slow MadhivananFailing to plan is Planning to fail |
 |
|
|
swathigardas
Posting Yak Master
149 Posts |
Posted - 2008-09-04 : 08:14:11
|
| Thanks visakh for the solution |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-04 : 08:44:08
|
quote: Originally posted by swathigardas Thanks visakh for the solution
Note that if you want to have default value for a column, exclude it from INSERT statementMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|