473,383 Members | 1,795 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,383 software developers and data experts.

Split Function in Sql stored procedure

Soniad
66
Hello,

I am new to stored procedure, i am passing one parameter to stored procedure (comma seperated). i want to know how to split this variable inside stored procedure.

Expand|Select|Wrap|Line Numbers
  1. Sample :
  2.  
  3. Exec mystoreproc  '1,2,3,4,5'
i want to split '1,2,3,4,5' in commas and to loop through these numbers.
how to do..???

Regards,
"D"
Jan 24 '09 #1
4 9014
ck9663
2,878 Expert 2GB
Depends on what you're going to do with it. What do you have so far?


-- CK
Jan 24 '09 #2
Soniad
66
@ck9663
I want to split these numbers (1,2,3,4,5) and want to insert this id one by one in a table. if it was in vbscript or javascript i wud have done it..but don't have any idea how to do in stored procedure..the only idea i have is that by using CHARINDEX it cud be done.but how??
any suggestion please..


Regards,
"D"
Jan 25 '09 #3
ck9663
2,878 Expert 2GB
Use this technique.


-- CK
Jan 25 '09 #4
Soniad
66
@ck9663
Thanks for ur assistance.

Regards,

"D"
Jan 31 '09 #5

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

Similar topics

4
by: Bob Murdoch | last post by:
I have an ASP application that calls a COM function to create a custom report as an Excel file. This works in a synchronous fashion, as long as the report does not take too long to create. If...
0
by: Mark Oueis | last post by:
Is there any way I can retrieve the result set of a Stored Procedure in a function. ALTER FUNCTION dbo.fn_GroupDeviceLink ( @groupID numeric ) RETURNS @groupDeviceLink TABLE (GroupID numeric,...
3
by: Mariusz | last post by:
I want to write function to call another function which name is parameter to first function. Other parameters should be passed to called function. If I call it function('f1',10) it should call...
20
by: Tom van Stiphout | last post by:
I'm about to write a function like below, which I'm going to call a lot of times. So I care about possible memory leaks. I think whether I should use Erase or not depends on whether Split creates...
6
by: yamu_rhyme | last post by:
Is there any split function in DB2? How to split a field value separated with delimiter ","(comma)?
12
by: Steve Blinkhorn | last post by:
Does anyone know of a way of accessing and modifying variables declared static within a function from outside that function? Please no homilies on why it's bad practice: the context is very...
1
by: satish mullapudi | last post by:
Hi, I am using DB2 v8.2 & jdk 1.4. 1. I have a java program which returns an array which contains 1 to 5 numbers. The code: public class ArrayTest { public static final int ARRAY_SIZE = 5;...
2
by: IuliaS | last post by:
Hello everyone! I want to create a stored procedure, so I can more easily, and transparent retrieve data from db2. Long story short: when a user wants to put some data in the DB, he also creates...
7
by: jamesclose | last post by:
My problem is this (apologies if this is a little long ... hang in there): I can define a function in VB.NET with optional parameters that wraps a SQL procedure: Sub Test(Optional ByVal Arg1...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...

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.