Click here to Skip to main content
15,886,362 members
Home / Discussions / Database
   

Database

 
QuestionTemporary Table and Order By Pin
swjam30-Mar-09 18:26
swjam30-Mar-09 18:26 
AnswerRe: Temporary Table and Order By Pin
sam#30-Mar-09 20:55
sam#30-Mar-09 20:55 
GeneralRe: Temporary Table and Order By Pin
swjam30-Mar-09 21:09
swjam30-Mar-09 21:09 
GeneralRe: Temporary Table and Order By Pin
Mycroft Holmes30-Mar-09 21:35
professionalMycroft Holmes30-Mar-09 21:35 
GeneralRe: Temporary Table and Order By Pin
ButtonMoon31-Mar-09 11:36
ButtonMoon31-Mar-09 11:36 
GeneralRe: Temporary Table and Order By Pin
Mycroft Holmes31-Mar-09 13:58
professionalMycroft Holmes31-Mar-09 13:58 
AnswerRe: Temporary Table and Order By Pin
Ashfield31-Mar-09 1:30
Ashfield31-Mar-09 1:30 
QuestionReading Columns Pin
ffowler30-Mar-09 10:00
ffowler30-Mar-09 10:00 
Greetings All,

I have a particular problem that I am hoping someone with some TSQL know-how can assist me with.

Here's the issue:
I have a table that contains 40 some-odd columns. the first 2 columns are essentially identifiers. The following columns are components of the identifier. To give a clear picture, lets' say the first row has CHCK in the 1st column and Chocolate Cake in the 2nd column. The rest of the columns contains the ingredients of the Chocolate Cake (let's say 7 ingredients). The next row is for Grilled Cheese. This row would only have 3 ingredients.

Here is what I would like to achieve:
I want to run through each row and read every column to see if there is a value in it. If there is a value, I would like to put the identifier and the ingredient in another table with an insert so that this new table (with only 2 columns) looks something like this
CHCK eggs
CHCK milk
GCHEES bread
GCHEESE cheese

Is there a way that I could do this in a stored procedure? I know that I could use a cursor to the rows but each row could have a variable number of *ingredients* and that is where I am lost.

Thank you in advance for any suggestions you may offer.
AnswerRe: Reading Columns Pin
sam#30-Mar-09 20:52
sam#30-Mar-09 20:52 
AnswerRe: Reading Columns Pin
Mycroft Holmes30-Mar-09 21:42
professionalMycroft Holmes30-Mar-09 21:42 
GeneralRe: Reading Columns Pin
Jörgen Andersson30-Mar-09 23:37
professionalJörgen Andersson30-Mar-09 23:37 
AnswerRe: Reading Columns Pin
anup keshari30-Mar-09 21:47
anup keshari30-Mar-09 21:47 
GeneralRe: Reading Columns Pin
anup keshari30-Mar-09 22:02
anup keshari30-Mar-09 22:02 
AnswerRe: Reading Columns Pin
anup keshari30-Mar-09 22:33
anup keshari30-Mar-09 22:33 
GeneralRe: Reading Columns Pin
ffowler31-Mar-09 2:05
ffowler31-Mar-09 2:05 
QuestionLooking for a Web/SQL reporting subsystem Pin
Max Stayner30-Mar-09 9:47
Max Stayner30-Mar-09 9:47 
AnswerRe: Looking for a Web/SQL reporting subsystem Pin
Mycroft Holmes30-Mar-09 21:45
professionalMycroft Holmes30-Mar-09 21:45 
QuestionSumming Amount by Group field Pin
BijayaSharma30-Mar-09 9:36
BijayaSharma30-Mar-09 9:36 
AnswerRe: Summing Amount by Group field Pin
Anubhava Dimri31-Mar-09 1:09
Anubhava Dimri31-Mar-09 1:09 
GeneralRe: Summing Amount by Group field Pin
BijayaSharma31-Mar-09 4:19
BijayaSharma31-Mar-09 4:19 
GeneralRe: Summing Amount by Group field Pin
BijayaSharma1-Apr-09 6:28
BijayaSharma1-Apr-09 6:28 
QuestionHow do i display Values Horizonatally In Crystal Reports Pin
Veerkumar Patil30-Mar-09 4:31
Veerkumar Patil30-Mar-09 4:31 
AnswerRe: How do i display Values Horizonatally In Crystal Reports Pin
anup keshari30-Mar-09 4:58
anup keshari30-Mar-09 4:58 
QuestionAbout Database Certifcation Pin
Isaac Gordon30-Mar-09 2:03
Isaac Gordon30-Mar-09 2:03 
AnswerRe: About Database Certifcation Pin
Eddy Vluggen30-Mar-09 3:14
professionalEddy Vluggen30-Mar-09 3:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.