Hi,
I am getting error as below while inserting multiple records in table
Code : INSERT INTO Management.Departments(DepartmentCode, Name)
VALUES(N'ITEC', N'Information Technology'),
(N'PRSN', N'Personnel');
Error code : Msg 102, Level 15, State 1, Line 3 Incorrect syntax near ','.
My MS SQL server version is:-
Microsoft SQL Server 2005 - 9.00.5000.00 (Intel X86)
Dec 10 2010 10:56:29
Copyright (c) 1988-2005 Microsoft Corporation
Express Edition on Windows NT 6.1 (Build 7601: Service Pack 1)
compatibility level 90
Please help me that why I am not able to insert multiple records and how this problem can be solved?
9 2770
Try removing those Ns
Happy Coding!!!
~~ CK
Hi,
Thanks for replying me. However the checked by removing Ns still it is not working.
Don't think you can insert multiple records that way.
Hi,
No I am able to insert multiple records as I mentioned earlier...
No... you said you're getting an error trying to insert multiple records using that syntax. You didn't say you were able to insert multiple records. Otherwise, you have no question.
Oooppss, sorry I missed that. I don't think you can insert rows that way. If you want you can use UNION ALL to combined those two rows that you are trying to insert.
Happy Coding!!!
~~ CK
Sorry i missed "not" in my last conversation...I am not able to insert records through the query i mentioned above.
Even i tried union all in last it did not worked.
Try like this it will work if your data types are char or varchar for both columns.
INSERT INTO Management.Departments(DepartmentCode, Name)
VALUES('ITEC', 'Information Technology'),
('PRSN', 'Personnel')
You can either do two insert statements, or do a UNION ALL. Can you post the UNION ALL code that you did so we can see why it failed?
~~ CK
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ramesh |
last post by:
hi
I am trying to insert 50,000 random records in the SQL
server. I have created COM for inserting records. When i
started inserting, after 44152 records it displayed
following error message.
"...
|
by: Brian |
last post by:
I need help PLEASEEEEEEEEEEEEEEE.....
I am trying to create a list of questions that have yes/no answers.
There are 8 groups of questions. Based on who the user is that logs in
will determine...
|
by: shank |
last post by:
I'm trying to use online samples for submitting multiple records from ASP
into a stored procedure. Failing! Through the below form, a user could be
submitting many records at a time. I'm not...
|
by: flashguy |
last post by:
Hi,
Looking online for this related topic that will be exclusively used for MS ACCESS (2000 preferably) is extremely limited.
Is it possible to add Multiple records with one click of a buttton...
|
by: chumlyumly |
last post by:
Hello scripters -
OS: Mac OSX
Language: PHP w/ MySQL database
I've created an insert page where a user inputs his info, which then goes to four different tables in a MySQL database. The...
|
by: tamimmakki |
last post by:
hi, i have to add names of 11 players of a team into database table 'tbl_players'. so i put 11 text boxes in form with a submit button. I tried it with a for loop but its not working. I am working in...
|
by: t8ntboy |
last post by:
ASP/SQL Server Express 05
I have two tables, A and B. I would like to insert multiple records
into both form A and B, but a field in form B is the Record ID in form
A. So, I need to insert the...
|
by: xixor |
last post by:
I work for a nonprofit organization that allows individuals to sponsor children overseas. Some of these sponsors decide to become volunteers and speak at their church, university, or other event to...
|
by: sreenu123 |
last post by:
How to insert multiple records into a database table that are entered into a datagridview. With a single shot of Save all the records in the datagridview should be updated using C# . Can any one help...
|
by: wozza |
last post by:
hi
I'm a Dreamweaver user who's created a few simple data entry/
registrations forms in my time, but I'm not really a coder (though I
can follow instructions and am not afraid to dabble...) - I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |