July 3, 2003 at 8:24 am
how can i do this
-------------------------------
set @na =SELECT [na] FROM [xsisi]
-----------------------------------
---------------
declare @na varchar(500), @sisi int, @mmh char(10)
set @sisi='2'
set @mmh='uuu'
set @na =SELECT [na] FROM [xsisi]
UPDATE Sn
SET [sisi] = @sisi,
[mmh] = @mmh
WHERE charindex(','+CONVERT(varchar,[na])+',',','+@na+',') > 0
--------------------
thnks ilan
July 3, 2003 at 8:42 am
Just do:-
select @na = [na] FROM [xsisi]
July 3, 2003 at 9:01 am
no it only update one record not all !!!
i the table [xsisi] i have 100 records
and like this it update only one
not the all 100 "FROM [xsisi]"
-------------
declare @na varchar(500), @sisi int, @mmh char(10)
set @sisi='1'
set @mmh='uuu'
select @na = [na] FROM [xsisi]
UPDATE Sn
SET [sisi] = @sisi,
[mmh] = @mmh
WHERE charindex(','+CONVERT(varchar,[na])+',',','+@na+',') > 0
-----------------------
July 4, 2003 at 6:56 am
select @na = @na + cast([na] as varchar) + ',' FROM [xsisi]
Would'nt it be better to rewrite the query thus
UPDATE a
SET a.sisi = @sisi,a.mmh = @mmh
FROM Sn a
INNER JOIN [xsisi] b ON b.na = a.na
Far away is close at hand in the images of elsewhere.
Anon.
July 5, 2003 at 2:48 pm
OK i workig 100%
thnks
a little question
how can i add more filed to update
like
----------------
@Fname[nvarchar](50),@fld1 [smalldatetime], @fld2[int],
-----------------------
i wont to learn the method
---------------------------
declare @na varchar(500), @sisi int, @mmh char(10)
set @sisi='2'
set @mmh='uuu'
select @na = @na + cast([na] as varchar) + ',' FROM [vsisi]
UPDATE a SET a.sisi = @sisi,a.mmh = @mmh
FROM Sn a INNER JOIN [vsisi] b ON b.na = a.na
--------------
thnks a lot
ilan
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy