Multiple values to store in multiple variables

  • Do you know all of the codes? Can you create a look-up table with all of the codes in?


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • For sequence we have have to follow the sequence (requirement already specified for this )

  • simhadriraju (2/7/2012)


    For sequence we have have to follow the sequence (requirement already specified for this )

    You have already specified at least two different sequences + the following quote:

    Here the somevalue could be a random sequence which we cannot guess

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • I'm still waiting for the information I requested from you a few posts back. I thought I was pretty specific about what was needed.

    I'm not going to try and guess at what you sre trying to accomplish. When you can post specifics such that we can actually see what you are trying to do, I'll be back to help.

  • What you are asking for, and I'm still not clear on this, is something that is completely custom. There's no way a component is going to be available for pulling the max(ID) of some table, or all tables, when there isn't a pattern or relation. That's what custom development is for.

    You could conceivably use some code to generate the custom statements for you, but ultimately they aren't going to programatically do this for you, and even if you did get this written, I'm not sure I'd trust it. There are so many changes for bugs in here.

    Both Koen and Lynn have tried to help you, but it seems you want to avoid the work of writing hundreds of custom SQL statements when you can't reliably produce a pattern in a description, much less code.

    Perhaps we're wrong, but you can't write:

    Table Code_desc

    description

    code_type

    code

    i have the data like below

    Code_desc

    Description -- Code_type -- Code

    Order Types description ORDTYP ORDT

    Product Types description PRDTYP PRDT

    Customer Types description CustTYP CUDT

    ........................... ........................................

    And expect us to get your data.

    Use DDL and DML.

    create table code_desc (description varchar(200, code_Type varchar(10), code varchar(20))

    go

    insert code_desc select 'Order Types', 'ORDTYP'm 'ORDT'

    ...

    If you're trying to export all these codes to a flat file, with some additional processing, are you sure you can't do this in a set based manner? If each code comes out, is there some pattern of processing done before export? SSIS will, in fact, let you pull the whole table into a variable in the stream and then do processing to all rows at once, with values from other tables or variables. You need a pattern to do this, however, and you haven't produced a pattern. At least not in the description.

    Rather than getting hung up on "getting these values into variables", stop and think about what needs to happen in the flat file, explain that, and then listen to the suggestions. Don't keep posting "I need help, give me a solution". If you need that, hire someone.

    and then show what values you need.

Viewing 5 posts - 31 through 34 (of 34 total)

You must be logged in to reply to this topic. Login to reply