Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-05-27 : 10:43:49
|
| Behdad Khoshbin writes "Hello I have created the following table in sqlserver:CREATE TABLE [dbo].[Books_Tbl] ( [intBookID_PK] [int] NOT NULL , [strBookTitle] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [intAuthorID_FK] [int] NOT NULL , [imgPhoto] [image] NULL , [intBookSamplePro] [int] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]and I try to run the following query :declare @intBookID_PK intset @intBookID_PK=15declare @strBookTitle nvarchar(50)set @strBookTitle=N'Test OK3!'declare @intAuthorID_FK intset @intAuthorID_FK=1--declare @imgPhoto image--set @imgPhoto=nulldeclare @intBookSamplePro intset @intBookSamplePro=null--=========================================================================================================================declare @Original_intBookID_PK intset @Original_intBookID_PK=15declare @Original_strBookTitle nvarchar(50)set @Original_strBookTitle=N'Test OK3!'declare @Original_intAuthorID_FK intset @Original_intAuthorID_FK=1declare @Original_imgPhoto int--set @Original_imgPhoto=nulldeclare @Original_intBookSamplePro intset @Original_intBookSamplePro=nullUPDATE Books_Tbl SET intBookID_PK = @intBookID_PK, strBookTitle = @strBookTitle, intAuthorID_FK = @intAuthorID_FK, imgPhoto = null, intBookSamplePro = @intBookSamplePro WHERE (intBookID_PK = @Original_intBookID_PK) --AND (intAuthorID_FK = @Original_intAuthorID_FK) AND((intBookSamplePro = @Original_intBookSamplePro) OR (intBookSamplePro IS NULL and @Original_intBookSamplePro is null))But it affectes no rows!! but commenting out one of @Original_intBookSamplePro is null (OR) intBookSamplePro IS NULL will make it affect one row.I am using SqlServer 2000and my table contains 6 rows but one row with following :[intBookID_PK]=15[strBookTitle]=Test OK3![intAuthorID_FK]=1nullnullThanks in advance!Behdad Khoshbin" |
|
|
|
|
|