Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server-2008
Hi,
 
I have a SQL Table , in that one of the col is Material (INT).
 
Now, My task is i want to take a list of materials into ListBox, and then i select some of them, and then insert in to my table is it possible.
 

for ex:
 
varchar --- 'a,b,c,d' --- its inserted why bcz with in the single quotation we
are passing N no.of values means it's consider as a single
parameter.
 
similarly
 
int --- 1,2,3,4 --- has to be inserted into my table in a single insertion only.
 
can any one help me to do this..
 
Thanks in advance...
Posted 14-Sep-12 3:34am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Do you really want to insert multiple values into one column in one single row? Then you decided for a very bad design: read about "normalization"!
Better use one value for the column per row, and use a "transaction" to make sure that all values are inserted (or none in case of failure).
  Permalink  
Comments
Bernhard Hiller at 14-Sep-12 9:05am
   
Then change the column to varchar and treat the int as string.
Bernhard Hiller at 14-Sep-12 9:25am
   
By the way, when the numbers are small numbers like those you showed, you could treat them like "flags": calculate 2^number for each number, sum that up, and store the result.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 290
1 Jochen Arndt 150
2 Kornfeld Eliyahu Peter 149
3 PIEBALDconsult 110
4 Richard MacCutchan 105
0 OriginalGriff 6,080
1 DamithSL 4,648
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,624
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 14 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100