Forum Replies Created

Viewing 15 posts - 8,251 through 8,265 (of 8,731 total)

  • RE: Give Varibale as column name

    Sean Lange (11/2/2012)


    That seems like a horrible way to name your columns but in order to do that you will have to use dynamic sql. Make you sure you wrap...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Must declare the scalar variable when running script

    Yoou really shouldn't be dealing with T-SQL if you don't know what UPDATE or EXEC are and what are they capable of doing.

    Here's the script with the correction that I'm...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Must declare the scalar variable when running script

    Try changing the EXEC (@SQLCmd) before the update.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Must declare the scalar variable when running script

    You have your @SCLCmd Declaration in a different batch that ended at GO.

    What are you trying to do?

    The dynamic part is just changing the database you're on but your not...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Confused by table size

    Michael Valentine Jones (11/1/2012)


    There is a good chance that all the space is being used by the transaction log. If the database is in full recovery mode and you...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: trying to export to .CSV with comma delimited AND double-quotes

    Out of curiosity, have you tried the import/export wizard?

    It's a simple tool, just be sure to read all the options available.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: LIKE operator with INNER JOIN

    mickyT (11/1/2012)


    Luis Cazares (11/1/2012)


    Micky,

    Your first query is not sargable and that would make it pretty inefficient compared to the second one. 😉

    True :Whistling:

    Not knowing what the data is for, I...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: LIKE operator with INNER JOIN

    Micky,

    Your first query is not sargable and that would make it pretty inefficient compared to the second one. 😉

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: SQL Multiple Pivot

    Be careful methexis, because both queries aren't the same. One uses MAX and the other uses SUM. In this case the show the same results but it won't be like...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: 100 Most famous interview Questions and Answers

    GSquared (10/31/2012)


    On the other hand ... if anyone ever publishes "Trivial Pursuit, DBA Edition", they could come in very handy indeed!

    Would you buy it? Or would you play it?

    EDIT:...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Question - How to insert record from within an select statement -

    It's hard to be sure about what you need to do, but as I uderstood, you have a Sites table that is referenced by the OrderHeader table.

    I'm thinking of 2...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Is it "better" to specify the definition of a temporary table, or just define it on the fly?

    Jeff Moden (10/30/2012)


    Luis Cazares (10/30/2012)


    I knew it was doable, but I believe is better to have an explicit CREATE TABLE statement for this situations.

    Why?

    Why? Because I get paid by line...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Is it "better" to specify the definition of a temporary table, or just define it on the fly?

    I knew it was doable, but I believe is better to have an explicit CREATE TABLE statement for this situations.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Is it "better" to specify the definition of a temporary table, or just define it on the fly?

    There's a small confusion.

    INSERT INTO, won't create a table, SELECT INTO will. Example:

    --This will create a table

    SELECT column1, column2, column3

    INTO #TempTable

    FROM MyTable

    --This won't

    INSERT INTO #TempTable

    SELECT column1, column2, column3

    FROM MyTable

    Now, to...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: combine 2 rows into 1 row

    I believe there's a way to do it much simpler. But you'll need to test.

    DECLARE @StartDate DATETIME

    DECLARE @EndDate DATETIME

    SET @StartDate = '1/1/2012'

    SET @EndDate = '1/31/2012'

    SELECT ER.EngEquipID

    ,ER.Location

    ,ER.Cycles

    ,ER.DateTimeStamp

    ,'Labor' AS Labor

    ,ISNULL( A.TRANS_tambase_amt, 0)...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 8,251 through 8,265 (of 8,731 total)