Results 1 to 3 of 3

Thread: My Query

  1. #1
    Join Date
    Apr 2004
    Location
    Mumbai,India.
    Posts
    7

    Unanswered: My Query

    Hello!
    Can any one help me solve this????
    I am using MS SQL 2000 database for developing crystal reports for my company.
    Now in this I am doing as follows:
    I want to concate "dataset_" string with End_A--which is a column name in one table.(Result is like "dataset_1464")I am storing this result in a variable A.
    And,now result of this query (A) is name of one table in same database.
    Can I use this result ,i.e. A to get MM, which is a column in A.
    Here I want to use A instead of dataset_1464.
    Please help me if its possible.
    thanks in advance,
    chandresh

  2. #2
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    select @var1 = 'dataset_'+convert(varchar(30),END_A) from table_A


    sp_executesql ('select mm from '+@var1)
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  3. #3
    Join Date
    Apr 2004
    Location
    Mumbai,India.
    Posts
    7

    My Query

    select @var1 = 'dataset_'+convert(varchar(30),END_A) from table_A


    sp_executesql ('select mm from '+@var1)



    HI Thanks alot for prompt reply....
    I used this method but it still gives me error like:
    Server: Msg 170, Level 15, State 1, Line 4
    Line 4: Incorrect syntax near 'select mm from '.



    wht colud be the reason?????
    thanks (again) in advance..
    chandresh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •