473,400 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

MS SQL server Insert Error [109]

Greetings!

When I run the following SQL statement in Perl, I get an error
stating:
any help/pointers how this can be resolved?

Thanks,
-Murali

SQL note_insert error: [109] [2] [0] "[Microsoft][ODBC SQL Server
Driver][SQL Server]There are more columns in the INSERT statement than
values specified in the VALUES clause. The number of values in the
VALUES clause must match the number of columns specified in the INSERT
statement."

The perl code:

$sql_stmt1 = "select cast(newid () as varbinary(16)) as notes_id
from cc_test";

if($db_ends->Sql($sql_stmt1))
{
$db_ends->Error();
exit(-1);
}

while($db_ends->FetchRow())
{
undef %Data;
%Data = $db_ends->DataHash();
$notes_id = $Data{"notes_id"};
}

# Prepare the columns for insert

my $updated_detail = "$pn . $cc_ver\n";

my $note_columns = "user_note_id, bio_name, related_tbl_name,
related_string_id, related_int_id, note_type_lkp, notes,
internal_flag, revision_number, obsolete_flag";

my $note_values = "cast(" +$notes_Id + "as binary(16)), Null, Null,
Null, $bfn, 0x74942E5A0A04022800415DE63529D4B7, $notes_detail, 0, 0,
0";

$sql_note_insert = "insert into user_note ($note_columns) values
($note_values)";

if($db_ends->Sql($sql_note_insert))
Jul 20 '05 #1
1 6079
Make sure you delimit all strings with single quotes ('). If one of the
current variables (such as $note_details) contains a comma, then you
will have more "values" than "columns".

If this doesn't work, then please post the actual query you are
submitting to SQL-Server.

Hope this helps,
Gert-Jan
Murali Kanaga wrote:

Greetings!

When I run the following SQL statement in Perl, I get an error
stating:
any help/pointers how this can be resolved?

Thanks,
-Murali

SQL note_insert error: [109] [2] [0] "[Microsoft][ODBC SQL Server
Driver][SQL Server]There are more columns in the INSERT statement than
values specified in the VALUES clause. The number of values in the
VALUES clause must match the number of columns specified in the INSERT
statement."

The perl code:

$sql_stmt1 = "select cast(newid () as varbinary(16)) as notes_id
from cc_test";

if($db_ends->Sql($sql_stmt1))
{
$db_ends->Error();
exit(-1);
}

while($db_ends->FetchRow())
{
undef %Data;
%Data = $db_ends->DataHash();
$notes_id = $Data{"notes_id"};
}

# Prepare the columns for insert

my $updated_detail = "$pn . $cc_ver\n";

my $note_columns = "user_note_id, bio_name, related_tbl_name,
related_string_id, related_int_id, note_type_lkp, notes,
internal_flag, revision_number, obsolete_flag";

my $note_values = "cast(" +$notes_Id + "as binary(16)), Null, Null,
Null, $bfn, 0x74942E5A0A04022800415DE63529D4B7, $notes_detail, 0, 0,
0";

$sql_note_insert = "insert into user_note ($note_columns) values
($note_values)";

if($db_ends->Sql($sql_note_insert))

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: avinash | last post by:
hello myself avinash i am developing on application having vb 6 as front end and sql server 7 as back end. when i use insert query to insert data in table then the date value of that query is...
5
by: Phil Grimpo | last post by:
I have a very odd situation here. I have an administration page, where based on a users permissions, a recordset is called from the SQL server which has a list of paths to "Module Menus". Each of...
4
by: Phil Grimpo | last post by:
I had previously explained this problem in a different thread, but now that I have an IISState log, I figured I'd re-start the thred. My situation and the log are following... I have a very odd...
2
by: Praveen | last post by:
Hi All, I have made a webservice in C# and it works fine in my machine. I ran into a crazy problem when I wanted to deploy it in windows 2003 server. I have run "aspnet_regiis.exe -i" to make...
2
by: Dabbler | last post by:
I'm getting the following error when I try and insert a row using FormView, ObjectDataSource and stored procedure. The form has 40+ columns on it and I'm not sure how to diagnose where the problem...
15
by: Pucca | last post by:
I'm getting an error when I tried to use this BerConverter class in my C# code. Even though the Interent doc says that it runs on Win2000 sp4, I just thgouth I'll double check. Does anyone know...
0
by: tom c | last post by:
I am going through "Walkthrough: Editing and Inserting Data in Web Pages with the DetailsView Web Server Control" found at http://msdn2.microsoft.com/en-us/library/sdba1d59.aspx I am using...
76
by: rcoco | last post by:
Hi all, I'm facing this problem I have images on my website but when I Deploye the website on server the Images are not there I only get the X sign. How can I go about this. Thanks
0
by: Bhavesh | last post by:
Hello genious people, I m trying to insert a LARGE text from Multiline Textbox into my table of sqlserver2000. I m using vs-2005. Please note that I dont want to store blob data From FILE TO...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
marktang
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.