Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > win32::sqlserver not able to sql_insert

Reply
Thread Tools

win32::sqlserver not able to sql_insert

 
 
Digger
Guest
Posts: n/a
 
      08-29-2007
Hi,
I hope that anybody have info on this, i've install and have
win32::sqlserver working properly.
I'm able to retrieve data from my database with the select statement.

My problem is with sql_insert here my code:

my $table = "icon";
#my %values=("iconID"=>'3',"link"=>"something");
#my %values=("iconID"=>3,"link"=>"something");
#my %values=("iconID"=>"3","link","something");
#my %values=("iconID",3,"link","something");
my %values=("iconID","3","link","somethingElse");

$sqlsrv->sql_insert($table,\%values);

Table is call icon, iconID is a primary key and an integer, link is a
varchar.

Here the error I get all the time:
SQL Server message 515, Severity 16, State 2, Server WEB-T-
SQL1\DVSQBQL
Line 1
Cannot insert the value NULL into column 'iconid', table
'master.dbo.Icon'; column does not allow nulls. INSERT fails.
1> EXEC sp_executesql N'INSERT icon (iconID, link)
2> VALUES (@P1, @P2)',
3> N'@P1 int, @P2 varchar(13)',
4> @P1 = NULL, @P2 = 'somethingElse'
The statement has been terminated.

It look like it doesn't like my value for IconID, what's missing...
take me out of my misery.

Thx,

Michel

 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      08-30-2007

Quoth Digger <(E-Mail Removed)>:
> Hi,
> I hope that anybody have info on this, i've install and have
> win32::sqlserver working properly.
> I'm able to retrieve data from my database with the select statement.
>
> My problem is with sql_insert here my code:
>
> my $table = "icon";
> #my %values=("iconID"=>'3',"link"=>"something");
> #my %values=("iconID"=>3,"link"=>"something");
> #my %values=("iconID"=>"3","link","something");
> #my %values=("iconID",3,"link","something");
> my %values=("iconID","3","link","somethingElse");
>
> $sqlsrv->sql_insert($table,\%values);
>
> Table is call icon, iconID is a primary key and an integer, link is a
> varchar.
>
> Here the error I get all the time:
> SQL Server message 515, Severity 16, State 2, Server WEB-T-
> SQL1\DVSQBQL
> Line 1
> Cannot insert the value NULL into column 'iconid', table
> 'master.dbo.Icon'; column does not allow nulls. INSERT fails.
> 1> EXEC sp_executesql N'INSERT icon (iconID, link)
> 2> VALUES (@P1, @P2)',
> 3> N'@P1 int, @P2 varchar(13)',
> 4> @P1 = NULL, @P2 = 'somethingElse'
> The statement has been terminated.
>
> It look like it doesn't like my value for IconID, what's missing...
> take me out of my misery.


Type int, value NULL seems to be what Win32::SqlServer inserts when it
doesn't recognise the column name. Since SQL Server seems to think the
column is called 'iconid', not 'iconID', perhaps you should try that.

Is there a good reason you're not using DBI? While it may not support so
much of the SQL-Server-specific API, it's probably better tested.

Ben

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not able to display color in excel not able to display color in excel using xml sed_y XML 0 02-15-2012 09:46 PM
Not able to Connect to Internet while using wireless card =?Utf-8?B?c3JlZWhhcmk=?= Wireless Networking 3 11-10-2004 10:19 PM
Not able to Connect to Internet while using wireless card =?Utf-8?B?c3JlZQ==?= Wireless Networking 0 11-09-2004 06:07 PM
Not able to acces authentication tab wireless networkconnection pr =?Utf-8?B?bm9vcmQ0NTM=?= Wireless Networking 3 10-15-2004 07:59 PM
Not able to veiw images and if tried EXPLORER NOT RESPONDING Jeff Computer Support 2 02-29-2004 07:00 PM



Advertisments