Re: win32::sqlserver not able to sql_insert




Quoth Digger <michel.knight@xxxxxxx>:
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

.



Relevant Pages

  • win32::sqlserver not able to sql_insert
    ... I'm able to retrieve data from my database with the select statement. ... SQL Server message 515, Severity 16, State 2, Server WEB-T- ... Cannot insert the value NULL into column 'iconid', ... 1> EXEC sp_executesql N'INSERT icon ...
    (comp.lang.perl.misc)
  • Re: Newbie question on meaning of icon...
    ... The 'sharing' hand means the database has been enabled for replication. ... I support the Professional Association for SQL Server ... > icon beside the db name. ...
    (microsoft.public.sqlserver.server)