Showing posts with label int. Show all posts
Showing posts with label int. Show all posts

Friday, March 30, 2012

I found a bug in Sql Server 2000!!!

Yesterday I created a table in Sql Server 2000,using this script:
CREATE TABLE [dbo].[User](
[Id] [int] NOT NULL,
[UserName] [nvarchar](20) NOT NULL,
[TrueName] [nvarchar](20) NOT NULL,
[Password] [nvarchar](60) NOT NULL,
[Department] [int] NOT NULL,
[Mobile] [nvarchar](20) NULL,
[Telephone] [nvarchar](20) NULL,
[Remark] [nvarchar](200) NULL,
[Enabled] [bit] NOT NULL,
[Available] [bit] NOT NULL,
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED
(
[Id] ASC
) ON [PRIMARY]
) ON [PRIMARY]
There was only one record in it:
INSERT INTO [User] VALUES(1,N'SUP',N'Jim',N'213123',1,NULL,NULL,NULL,1,1)
After I executed this script:UPDATE [User] SET UserName=N'f',TrueName=N'gg',[Password]=N'dfsdfsdf',Mobile=NULL,Telephone=NULL,Remark=NULL,
Enabled=1 WHERE [Id]=1 AND Available=1
The value of 'Available' field changed to Zero.That was not supposed to happen.
I'm pretty sure it is a bug, because when I did the same thing in Sql Server 2005, everything was correct.
Anybody can tell me if this is a known bug? I searched google,but couldn't find any answer.
Thanks!
"The value of 'Available' field changed to Zero"
Nope. Does not happened when i try it on my SQL Server 2000. It is still 1.
|||Thank you for trying it. But it went wrong on my machine. I also tried

in several other machines(all had service pack4 installed). They all

changed the 'Available' field.

Weirdly enough, when I changed the table structure, for example ,

changing the nvarchar field to nchar or cutting away the 'Enabled'

field, the bug disappeared.

Can anybody else try it? Please|||

Hi Okay,

No issues running on a 2k sp4 machine here.

Cheers

Rob

|||

Robert Varga wrote:

Hi Okay,

No issues running on a 2k sp4 machine here.

Cheers

Rob


Not win2000 sp4. I meant Sql Server 2000 sp4. The system is XP sp2.|||

Yes, that's what I meant: 2k = 2000, sp4

|||Mine is Personal Edition.I tried on Developer Edition just now, it didn't happen. Maybe that's the reason.

Friday, March 9, 2012

i am geeting an idea

any one please help me
In our company we maitain a table for cheques issued for
example the description is
cheques_issued(chq_no int, reciever_name varchar(30))
we ha ve so many number of records in this table with
defferent chq numbers.
one day our senio manager came to me and given a list of
100 numbers collected from the recievers and asked me to
find out how many of the numbers in the list of 100 given
by him are not there in the table.
is there any method to find it direectly trough a querry?
if i create a temp table i hve to use 100 insert
statements to send 100 values into temparary table and
compare the temp table with cheques_issued table. This is
problematic for me.
please give me any solution.Once you have your 100 numbers in a #temp table (called #temp100 here),
there are plenty of ways. Let's assume this DDL and sample data:
CREATE TABLE cheques_issued(chq_no INT)
INSERT cheques_issued VALUES(1)
INSERT cheques_issued VALUES(2)
INSERT cheques_issued VALUES(3)
INSERT cheques_issued VALUES(4)
CREATE TABLE #temp100(chq_no INT)
INSERT #temp100 VALUES(1)
INSERT #temp100 VALUES(2)
INSERT #temp100 VALUES(3)
INSERT #temp100 VALUES(4)
INSERT #temp100 VALUES(5)
INSERT #temp100 VALUES(6)
INSERT #temp100 VALUES(7)
You could get your results using a simple NOT IN
SELECT COUNT(*) FROM #temp100 WHERE chq_no NOT IN (SELECT chq_no FROM
cheques_issued)
Or a NOT EXISTS
SELECT COUNT(*) FROM #temp100 WHERE NOT EXISTS (SELECT chq_no FROM
cheques_issued WHERE chq_no = #temp100.chq_no)
Or a LEFT JOIN
SELECT COUNT(*) FROM #temp100
LEFT OUTER JOIN cheques_issued c
ON #temp100.chq_no = c.chq_no
WHERE c.chq_no IS NULL
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"kalyana chakravarthi" <kalyannow@.yahoo.com> wrote in message
news:05d001c3c069$3a4a6900$a401280a@.phx.gbl...
> any one please help me
> In our company we maitain a table for cheques issued for
> example the description is
> cheques_issued(chq_no int, reciever_name varchar(30))
> we ha ve so many number of records in this table with
> defferent chq numbers.
> one day our senio manager came to me and given a list of
> 100 numbers collected from the recievers and asked me to
> find out how many of the numbers in the list of 100 given
> by him are not there in the table.
> is there any method to find it direectly trough a querry?
> if i create a temp table i hve to use 100 insert
> statements to send 100 values into temparary table and
> compare the temp table with cheques_issued table. This is
> problematic for me.
> please give me any solution.
>