473,471 Members | 4,637 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Update rows with ids in CSV value passed to stored procedure

228 New Member
Hei all,

I am trying to update rows whose values is in a csv. i.e. 1,2,3

the stored proc looks like this:

Expand|Select|Wrap|Line Numbers
  1. spname(IN ids varchar(100)){
  2.  
  3. update tbl1 SET updaterow=1 WHERE rowid IN FIND_IN_SET(rowid,ids);
  4.  
  5. }
  6.  
Only one row gets updated. Any memory-safe work around this?
Jan 27 '15 #1
3 1245
Rabbit
12,516 Recognized Expert Moderator MVP
Find in set returns the index of the occurrence of the first parameter in the second parameter. You don't check the rowid against it, you just need to check that the return value is greater than zero.
Jan 27 '15 #2
samvb
228 New Member
I understand. Any work around? Is the only way to send the ids one by one for an update?
Jan 27 '15 #3
Rabbit
12,516 Recognized Expert Moderator MVP
You don't need a work around, you just need to use the function correctly. Like I said in my earlier post, check that the return value is greater than 0. There's no need for the IN operator nor the additional reference to rowid.
Jan 27 '15 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Paul | last post by:
Hi, In SQL Books Online in the section on @@Error it gives the following example: -- Execute the INSERT statement. INSERT INTO authors (au_id, au_lname, au_fname, phone, address, city,...
3
by: - | last post by:
I have a country table with code and name columns and create a stored procedure 'get_countries()' but have no idea what is the syntax to return multiple rows. I have searched the newsgroups and...
5
by: Wael | last post by:
Hi, I have the following stored procedure that does some processing and puts the result in a temporary table. I tried several things that procedure to display output that I can access with...
2
by: chandu | last post by:
Hi Guys, i am beginer in the worls of Asp.net and C#.net I have one problem that I have stored my changes of data into dataset using disconnected dataset and after completion of all changes i...
1
by: =?Utf-8?B?QmlzaG95?= | last post by:
Hi all, I have an asp.net 2.0 web site with a DetailsView control to select and insert data from database. I made the insert statement for that DetailsView by a stored procedure. I made some...
1
by: hellboss | last post by:
Hi to one & all ! I need to update multiple tables with a single stored procedure, is this possible added can we use the alaias or joins in update query ??? my query was looking like this ...
12
by: Dooza | last post by:
I have a stored procedure that takes a number of inputs, does a bulk insert, and then outputs a recordset. When I run the stored procedure in Server Management Studio I also get a return value from...
8
by: mcfly1204 | last post by:
I am executing a stored procedure that will always return a value, specifically an integer. The error handling within the stored procedure will return 0 if succesful, 1 on an error, and 2 for a...
0
by: perdijc | last post by:
The wizard to create dataset, automatically creates a method to update table if the dataset is based on table. If i create a dataset based on sotored procedure where this is based on more one...
1
by: MLarsB | last post by:
I have a stored procedure running in SQL Server 2000 which returns a value when I run it in SQL Server Management Studio 2008 (SMS). I have also tested it in SQL Server 2000 Query Analyzer with...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.