Sunday, 15 January 2012

Visual Studio 2013 SQL stored procedure updating a Bit column -



Visual Studio 2013 SQL stored procedure updating a Bit column -

so have stored procedure need update column value true/false based on column's beingness null or not.

i suppose needs this:

if([template] not null) begin update cmm_templates set [template_exists]=1 [id] = @id end

when trying update database, gives out:

an error occurred while batch beingness executed.

the table cmm_templates exists, columns , variable exists, problem in line:

set [template_exists]=1

if update column via variable, works. not if update directly.

i have tried:

set [template_exists]=1 set [template_exists]='true' set [template_exists]=cast('true' bit) set [template_exists]=cast(1 bit)

none of them seems work. i'm sure missing something, can figure out what.

any help appreciated.

i not understand part if([template] not null).

i suggest try:

update cmm_templates set [template_exists]=1 [id] = @id , [template] not null

sql stored-procedures visual-studio-2013

No comments:

Post a Comment