473,396 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Update rows with ids in CSV value passed to stored procedure

228 100+
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 1244
Rabbit
12,516 Expert Mod 8TB
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 100+
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 Expert Mod 8TB
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...

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.