Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 15th, 2004, 12:08 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default To split values and store in the database

I am inserting the multiple values in the database for a particular user, but now i want to insert the splitted values with that username.
eg,
user name areas
abc 10,14,15

Now i want to store in other table as
user name areas
abc 10
abc 14
abc 15


Please reply as soon as possible.
 
Old July 15th, 2004, 06:03 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi there,

If you don't use any client applications that could do this in much easier ways for you, then you will have to write a procedure/function that could do this for you in your Database.

I am not sure if you are trying to do this from a client-side application or on the SQL server directly. Let me know on this.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old July 15th, 2004, 06:48 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

If you are using a web technology then you can change it by using any client side scripting

Numan
--------------------------------------------------
Love is the most precious thing of this world. So find and grab it!
 
Old July 15th, 2004, 09:01 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I do something similiar to this all the time.

<%
Dim strAreas
Dim aryNumbers
Dim strUser

strUser = "abc"
strAreas="10,14,15"
aryNumbers = Split(strAreas, ",")

for i = 0 to UBound(aryNumbers)

    strSQL = "INSERT INTO YourDataBase (Username, Areas) " &_
            "VALUES ('" & strUser & "', '" & aryNumbers(i) & "');"
    objConn.Execute(strSQL)

    Response.Write(strUser & " - " & aryNumbers(i) & "----Was Inserted<BR>")
next
%>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to store "SET" values to Vector ? msg2ajay JSP Basics 1 September 4th, 2007 06:45 AM
use regex to split string store in dictionary edman747 VB How-To 0 January 29th, 2007 12:02 AM
Store Checkbox values in MySQL Database jkilgore Beginning PHP 1 July 7th, 2005 03:43 PM
Split database rylemer Access 1 August 30th, 2004 05:33 PM
store multiple values in a string bamboat_3 General .NET 3 May 23rd, 2004 07:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.