Forum Replies Created

Viewing 15 posts - 1,291 through 1,305 (of 2,894 total)

  • RE: Performance issue with tally solution

    paul.knibbs (9/5/2012)


    Adam Machanic (9/4/2012)

    The code that follows is my crack at a more memory efficient solution. It works only for a single delimiter (I never did see the point of...

  • RE: Finding a table with date appended to it and check for the range of that date

    That will return all tables with suffix YYYYMM where YYYYMM represent every month of the current calendar quarter.

    SELECT t.name

    FROM sys.tables t

    JOIN (SELECT '%' + CAST(QFM + m AS VARCHAR)...

  • RE: Finding a table with date appended to it and check for the range of that date

    Will your table suffix represent just year and month only YYYYMM or day as well YYYYMMDD?

    What criteria do you want to apply? Month number and year? Date range? Anything else?

  • RE: SQL help

    Your requirements are very unclear. Do you need to get records in relation to single requested id? Then you could use the following:

    declare @table table (dt datetime, id int)

    insert @table...

  • RE: Updating multiple rows for multiple values

    simonwestb (9/2/2012)


    Hi,

    I wasn't sure how to phrase my query so wasn't sure what to search for.

    I'm attempting the simplest of updates - e.g. "UPDATE CRnumbers SET StudyLocationID = " +...

  • RE: Select table names from queries

    dwain.c (8/31/2012)


    Eugene Elutin (8/31/2012)


    If you really like the challenge, this one for you:

    draw Mona Lisa using T-SQL (I remember I had seen assembler application which would print out this one...

  • RE: Select table names from queries

    ...

    And as to T-SQL not being the right tool, I smell a challenge, and you know I love a good challenge! Whatever tool you use, if it's going to...

  • RE: Select table names from queries

    dwain.c (8/31/2012)


    Eugene,

    Thanks for the suggestions on the comments. I'll run them through and try to improve it (I have some other ideas for it anyway).

    One question though. If...

  • RE: Unique runs

    Jeff Moden (8/30/2012)


    Eugene Elutin (8/30/2012)


    ...

    ...

    ,@tempno = helpergroupno = CASE

    ...

    Please note, the "three-parts" SET is not reliable. You better to split it to two of "two-part"...

  • RE: Select table names from queries

    Here the version which doesn't create stored proc.

    -- setup

    create table dbo._tt_t1 (c1 int)

    go

    create table dbo._tt_t2 (c1 int)

    go

    create table dbo._tt_t22 (c1 int)

    go

    create schema other

    go

    create table other._tt_t3 (c1 int)

    go

    create table other._tt_t33 (c1...

  • RE: Select table names from queries

    dwain.c (8/30/2012)


    I don't want anyone to think I'm getting defensive about my approach - I am not.

    But I've taken Eugene's comments about comments 🙂 into account and also eliminated VIEWs,...

  • RE: Select table names from queries

    It did took me a while.

    It may not be a bulletproof way, but much better than others I could think of so far...

    Enjoy:

    -- setup

    create table dbo._tt_t1 (c1 int)

    go

    create table...

  • RE: Select table names from queries

    While trying to come up with solution I've found some issue of getting the query plan for simple query.

    It all to do with automatic query parametrisation. Check this out:

    create table...

  • RE: Select table names from queries

    There is only one way to get it done with 100% accuracy.

    In order to do so, you should be able to execute each query in a relevant database where it...

  • RE: Select table names from queries

    ...

    not to mention finding tables inside comments...you need to strip comments out too.

    Dwain solution will also suffer from having comments and also heavily depends on statement formatting

    Try:

    create table #temp1 (query...

Viewing 15 posts - 1,291 through 1,305 (of 2,894 total)