Forum Replies Created

Viewing 15 posts - 166 through 180 (of 214 total)

  • RE: Dynamically create SQL statement

    Worked like a charm! thanks!

    My next question is. With the table structure below, do you think my approach to make it dynamic works well? I didn't create...

  • RE: Dynamically create SQL statement

    Thanks!

    so, I edited my query ...and this is my full query. see my note All the way at the bottom.

    DECLARE @Fields AS VARCHAR(4000)

    Declare @ClientName AS VARCHAR(100)

    Declare @AuditYear AS VARCHAR(50)

    SET...

  • RE: Pivot table???

    Thanks to both...your replies have been very helpful.

  • RE: Pivot table???

    To simplify the question I showed 3 columns but in reality I will be using 170 columns I need to query.....so with that said, which solution will be the most...

  • RE: Pivot table???

    Can you show me an example of what you mean? I don't follow you.

  • RE: How to query these tables

    This is a sample of a query and data results. I think i may need to do a pivot but I've never created one....

    Query:

    SELECT top 100 tocid, prop_id,...

  • RE: string to table

    Mark, this is awesome! thanks...i think i will be using tally tables more often.

    Can yo please explain what AND type='P' is ?

    and how does Number work? is...

  • RE: SQL Native Client with ms access

    This worked:

    strConnection = "ODBC;Driver={SQL Native Client};Server=" & strSQLServer & ";Database=" & strSQLDatabase & ";Trusted_Connection=yes;" ' SQL Native Client 9.0 ODBC Driver

  • RE: Dynamic SQL

    changed to using a temp table and that worked!

    Select * Into ##tmpTableInfo From @MyTableVar

    Set @cmd = 'INSERT INTO tblFields (TableID, FieldName, FieldType)

    SELECT t.TableID,c.COLUMN_NAME,c.DATA_TYPE

    FROM ##tmpTableInfo as t

    INNER...

  • RE: Dynamic SQL

    I get this error msg:

    Must declare the table variable "@MyTableVar".

  • RE: searching table against variable list

    So this is the code that I am using for my solution:

    Insert Into [tblTables](TableName, TableIndex, SQLAuth)

    Select T.Tablename, 2, 0 From tblTables as T WHERE T.TableName

    IN (Select Item From DelimitedSplit8k(@TableNameHeader,',')...

  • RE: searching table against variable list

    So this is the code that I am using for my solution:

    Insert Into [tblTables](TableName, TableIndex, SQLAuth)

    Select T.Tablename, 2, 0 From tblTables as T WHERE T.TableName

    IN (Select Item From DelimitedSplit8k(@TableNameHeader,',')...

  • RE: searching table against variable list

    Good point...I guess it was just my lazyness. I'll save myself a headache later and look at that solution now. Thanks!

  • RE: searching table against variable list

    I will look at it. I am working with a small number of items in my list, so I am not worried about performance but for future use with...

  • RE: searching table against variable list

    I found another solution that looks like works for me as well:

    Select T.* from nj_toys_claims.dbo.tblTables as T WHERE T.TableName

    IN (Select value From fn_Split(@TableNameHeader, ','))

    if exists (select * from dbo.sysobjects...

Viewing 15 posts - 166 through 180 (of 214 total)