i test my code in vb.net it's ok has no mistakes
so the probelm is here also this query was working with the code but i don't know what happend :(
some one can tell me my
create PROCEDURE Customes_Tables_Update
(@Cust_newName nvarchar(50),@Cust_Name nvarchar(50),@Cust_Addrs nvarchar(50),@Brch_ID int,@cust_id int)
AS
if @Brch_ID <> 0
UPDATE Customes_Tables
SET Brch_ID = @Brch_ID
WHERE (Cust_Name = @Cust_Name or cust_id=@cust_id)
if @Cust_newName <> null
UPDATE Customes_Tables
SET Cust_Name=@Cust_newName
WHERE (Cust_Name = @Cust_Name or cust_id=@cust_id)
if @Cust_Addrs <> null
UPDATE Customes_Tables
SET Cust_Addrs = @Cust_Addrs
WHERE (Cust_Name = @Cust_Name or cust_id=@cust_id)
Loading
Santhosh Kumar JayaramanPosted Dec 25, 2012, 4:20 AM
When you say @something <> null, this one is not a proper validation for null check.
you have to say @something is not null, then do something..
Always in SQL, write "Is null" instead of "= null"
and "is not null" instead of "<>null"
Otherwise you wont get your desired output
Akkiraju IvaturiPosted Dec 25, 2012, 1:40 AM
If you are getting an error, send me the error we may help you out.
Pradip PandeyPosted Dec 24, 2012, 12:25 AM
if @Cust_newName is not null
and
if @Cust_Addrs is not null
Hope it will help.
Vithal WadjePosted Dec 23, 2012, 11:20 PM