Error in Sql Execution

Error in Sql Execution

Post by Sreekanta Shast » Thu, 25 Jan 1996 04:00:00



Hi All,

I have Created a table

 createa table test(
 col1 int not null,
 col2 int null)

I created another stored procedure

as
begin



        begin tran t1



                select "Before Insert"

/* Error Has Been Purposefully Made By sending Null value to a Not Null Field */

                insert into test
                (col1,col2)
                values
                (NULL,12)


        begin
                rollback tran t1


        end
        else
        begin
                commit tran t1
                select "Commited"
        end

        return
end

when i execute the stored procedure

exec test_sp_1 188

will return error

Msg 233, Level 16, State 1:
Server 'SFSNADS', Procedure 'test_sp_1', Line 19:
The column col1 in table test does not allow null values.
(return status = -6)

I want to know why the messages
  "Within Stored Procedure"

  "Before Insert" are not displayed.


are not getting executed?

Thanks in advance.

Thanks
Shastry

 
 
 

Error in Sql Execution

Post by Atul Shar » Thu, 01 Feb 1996 04:00:00


The problem is that your insert statement has NULL for a not null clo1. Sybase
parser before the execution finds that insert will be invalid so gives you an error.
change this NULL to anything or reverse the values as 12 , NULL. It will fly.

Atul


> Hi All,

> I have Created a table

>  createa table test(
>  col1 int not null,
>  col2 int null)

> I created another stored procedure
> create proc test_sp_1

> as
> begin



>         begin tran t1



>                 select "Before Insert"

> /* Error Has Been Purposefully Made By sending Null value to a Not Null Field */

>                 insert into test
>                 (col1,col2)
>                 values
>                 (NULL,12)

 *****************************************************
                 here write
                  values
                  (12.NULL)

- Show quoted text -

> ****************************************************

>         begin
>                 rollback tran t1


>         end
>         else
>         begin
>                 commit tran t1
>                 select "Commited"
>         end

>         return
> end

> when i execute the stored procedure

> exec test_sp_1 188

> will return error

> Msg 233, Level 16, State 1:
> Server 'SFSNADS', Procedure 'test_sp_1', Line 19:
> The column col1 in table test does not allow null values.
> (return status = -6)

> I want to know why the messages
>   "Within Stored Procedure"

>   "Before Insert" are not displayed.


> are not getting executed?

> Thanks in advance.

> Thanks
> Shastry


 
 
 

1. SQLServer Agent - execution of CmdExec Jobs - execution error when owner<>sa

Hi,

when i try to start a SQL Server Agent Job that executes an external
program
i get an error when the owner of the job has not sa rights e.g.:

a Job with a single step
        Type:CmdExec
        Command: start c:\winnt\notepad.exe
works fine when the owner is 'sa'

with an owner who has no sysadmin rights it fails:
i get an error message box
        title:NOTEPAD.EXE - DLL-Init failed
        msg:Init of the DLL "c:\winnt\system32\user32.dll" failed. Process
terminated abnormal.
        (translated from german)

what i have verified so far:
        "c:\winnt\system32\user32.dll" exists and is ok.
        the checkbox on the job system tab in the sql server agent properties is
not checked.
        the SQL Server Agent Service is also allowed to interact with the desktop.

Does anybody know a way to get this work with a job owner without sysadmin
rights?
I need this for an application that creates SQLServer Agent jobs and
adjusts their schedule via the SQLDMO objects.
The application should not get general sysadmin rights.

Thanx
Heiko

2. alter session set current_schema

3. ODBC Error: SQL Statement Execution error

4. extracting parts of a hex-value

5. Sql execution error

6. How to get variable from program on the report

7. Error in execution of trigger - SQL SERVER 2000

8. monitor full-text index catalog

9. SQL Query Analyzer Execution Plan Cost Errors

10. Obj : Error with execution of stored proc SQL Server

11. OIP 08197 : SQL execution error

12. Help: PL/SQL execution error