Temp Table Data Types

  • Comments posted to this topic are about the item Temp Table Data Types

  • Nice question .. learned something from it ... thanks

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • bitbucket-25253 (3/12/2013)


    Nice question .. learned something from it ... thanks

    +1

    Thanks Dave

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • bitbucket-25253 (3/12/2013)


    Nice question .. learned something from it ... thanks

    +1

    I gotta learn about Select Into ; as I mostly avoid it , I don't pay attention ...

    I guessed for Varchar and Date :w00t:

    time for research 😎

    thanks for the question

    ~ demonfox
    ___________________________________________________________________
    Wondering what I would do next , when I am done with this one :ermm:

  • Nice question.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • demonfox (3/12/2013)


    bitbucket-25253 (3/12/2013)


    Nice question .. learned something from it ... thanks

    +1

    I gotta learn about Select Into ; as I mostly avoid it , I don't pay attention ...

    I guessed for Varchar and Date :w00t:

    time for research 😎

    thanks for the question

    Same here. Good learning. 🙂 !!!

    Thanks
    Vinay Kumar
    -----------------------------------------------------------------
    Keep Learning - Keep Growing !!!

  • One easiest way to avoid this confusion is .. don't use SELECT * INTO.

    Always prefer CREATE TABLE..

    --
    Dineshbabu
    Desire to learn new things..

  • Learned something new here, and by the way, the reference should be:

    Date, Time, and Timestamp Escape Sequences



    Ole Kristian Velstadbråten Bangås - Virinco - Facebook - Twitter

    Concatenating Row Values in Transact-SQL[/url]

  • okbangas (3/13/2013)


    Learned something new here, and by the way, the reference should be:

    Date, Time, and Timestamp Escape Sequences

    Good!

  • This was removed by the editor as SPAM

  • Stewart "Arturius" Campbell (3/13/2013)


    Interesting question, thanks Dave

    Another way to check the detail of the temp table would be to execute tempdb..sp_help #TempQoD

    Now this is very very new thing to me... thank you.

    (and for the INTO.. table stuff, I thought it is obvious... like when you use the import/export tool and when you trying to import the data from the excel file it marks all the column as varchar except the first one if there are any number like 1 2 3... it marks as int... and if we need the col type to any specific then the tool allows us to modify the value accordingly. As the source data is like a variant, I thought it will be difficult to sql to pick the exact datatype to meet the source and the destiny.... until proven otherwise. This is very interesting, thank you for posting the question, Dave)

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • Carlo Romagnano (3/13/2013)


    okbangas (3/13/2013)


    Learned something new here, and by the way, the reference should be:

    Date, Time, and Timestamp Escape Sequences

    Good!

    +1

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • Raghavendra Mudugal (3/13/2013)


    Stewart "Arturius" Campbell (3/13/2013)


    Interesting question, thanks Dave

    Another way to check the detail of the temp table would be to execute tempdb..sp_help #TempQoD

    Now this is very very new thing to me... thank you.

    (and for the INTO.. table stuff, I thought it is obvious... like when you use the import/export tool and when you trying to import the data from the excel file it marks all the column as varchar except the first one if there are any number like 1 2 3... it marks as int... and if we need the col type to any specific then the tool allows us to modify the value accordingly. As the source data is like a variant, I thought it will be difficult to sql to pick the exact datatype to meet the source and the destiny.... until proven otherwise. This is very interesting, thank you for posting the question, Dave)

    New thing for me too 🙂

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Stewart "Arturius" Campbell (3/13/2013)


    Interesting question, thanks Dave

    Another way to check the detail of the temp table would be to execute tempdb..sp_help #TempQoD

    +1 🙂

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Stewart "Arturius" Campbell (3/13/2013)


    Interesting question, thanks Dave

    Another way to check the detail of the temp table would be to execute tempdb..sp_help #TempQoD

    I often use sp_help to get db object info, but never try the query on explanation. That query can be handy since it provides more info about a particular table. Thank Dave!

    Derived on the query on the explanation, this query can be used to object info for other db objects such as trigger and stored procedure.

    USE tempdb;

    go

    SELECT *

    FROM sys.objects o

    LEFT JOIN sys.columns AS c ON c.object_id = o.object_id

    LEFT JOIN sys.types AS t ON t.system_type_id = c.system_type_id

    WHERE o.object_id = object_id('#TempQoD');

    --------------------------------------------------------------------------------------
    Hai Ton
    My Db4Breakfast blog.

Viewing 15 posts - 1 through 15 (of 36 total)

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