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
 General SQL Server Forums
 New to SQL Server Programming
 Insert Record

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2011-12-07 : 11:44:34
How to I insert a record into a table?

Do I have to list the column names somewhere?

insert into shipdtlbackup(
9999,
9999,
1,
'BOLT',
'DESC',
'VND',
22,
'123',
0,
'S',
' ',
' ',
' ',
0,
3.876,
' ',
' ',
7.8765,
999,
99999)
FROM SHIPDTLBACKUP

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-07 : 11:53:36
[code]
insert into shipdtlbackup
values(
9999,
9999,
1,
'BOLT',
'DESC',
'VND',
22,
'123',
0,
'S',
' ',
' ',
' ',
0,
3.876,
' ',
' ',
7.8765,
999,
99999)
[/code]
if you're passing values for all columns
if not you need to list the columns after tablename and before values clause like below

[code]
insert into shipdtlbackup
(column1,
column2,..
columnn)
values(
9999,
9999,
1,
'BOLT',
'DESC',
'VND',
22,
'123',
0,
'S',
' ',
' ',
' ',
0,
3.876,
' ',
' ',
7.8765,
999,
99999)
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -