Forum Replies Created

Viewing 15 posts - 886 through 900 (of 1,228 total)

  • RE: Arithmetic overflow error converting expression to data type int

    Put a PRINT before the INSERT statement, like this:

    PRINT @l_sql_string

    insert into TSTDB.dbo.CAPACITY...

    The last query printed will be the one which fails. Copy and paste it into a new query window...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Need simple way in TSQL to separate 1 column of data with embedded comma to 2 columns

    DROP TABLE #Test

    CREATE TABLE #Test (Col1 VARCHAR(250))

    INSERT INTO #Test (Col1) VALUES ('abc123 , xyz789')

    INSERT INTO #Test (Col1) VALUES ('a1 , z9')

    INSERT INTO #Test (Col1) VALUES ('b123456 , x99')

    SELECT Col1,

    Col2...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Print (5596 / 11784) --- > yields 0 (should return .47 and not 0)

    GaMusicMan (4/26/2011)


    In the SQL Server 2005 Management Studio, I have the following line of code in the query:

    Print (5596 / 11784)

    This should return the decimal .47 . Instead...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Need help with date

    PSB (4/26/2011)


    I have a query that I need to return results from 23 to < 6 (hours).

    ...

    SELECT DISTINCT txn.Terminal,txn.ActivityDate,datepart (hh,ActivityTime) As H

    FROM dbo.ABCD txn

    WHERE ActivityDate...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Today's Random Word!

    SQLRNNR (4/26/2011)


    Steve Jones - SSC Editor (4/26/2011)


    Rain

    We have SNOW

    Throughout the four-day Easter break here in the UK (that's the country with Cambridge in it, oh, and London too), the weather...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Adding rows od data together

    What are the rules associating different names?


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: combine 2 queries in Union

    Select A, B, C, D, E = CAST(NULL AS CorrectDataType)

    from tabl1

    Union

    Select A, B, C, D = CAST(NULL AS CorrectDataType), E

    from tbl2


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: NEED HELP= Monthly SQL database growth calculation script

    Syed Jahanzaib Bin hassan (4/22/2011)


    ...

    Check this script if you have any problem or modification required then tell me

    Regards,

    Syed Jahanzaib Bin Hassan

    MCTS | MCITP | OCA | OCP | OCE |...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Inserting into an associative table

    SELECT c.CompanyId, i.IndustryId

    FROM dbo.[source] s

    INNER JOIN dbo.Industry i ON s.Industry = i.IndustryName

    INNER JOIN dbo.Company c ON s.company = c.CompanyName

    WHERE c.CompanyId IS NOT NULL AND i.IndustryId IS NOT NULL...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Error - Attempting to set a non-NULL-able column's value to NULL

    Can you post the actual error message, and the actual statement which causes it? The following works just fine on SP1:

    CREATE TABLE #TableD (FieldE VARCHAR(10) NOT NULL)

    INSERT INTO #TableD VALUES...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Identifying hidden characters (pipes)

    -- What is the odd character and how many rows are affected?

    SELECT ASCII(LEFT(REVERSE(MyColumn),1)) FROM MyTable WHERE ASCII(LEFT(REVERSE(MyColumn),1)) < 48

    -- How does this work?

    DECLARE @MyString VARCHAR(15)

    SET @MyString = 'Something' + CHAR(13)

    SELECT...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Conversion failed when converting the varchar value int.

    The values returned by each condition of a CASE construct must be of the same data type. Change

    ,CASE When APrio1 = 4 then RespT1

    When APrio2 = 4 then RespT2

    When...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: simple case vs. searched case

    Jeff Moden posted an elegant proof not so long ago that simple CASE is converted internally to searched CASE, I'll see if I can find it.

    http://www.sqlservercentral.com/Forums/FindPost989878.aspx

    Edit: added link


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Strange performance boost by query rewrite

    Even with NOT EXISTS?

    SELECT d.*

    FROM Data d

    WHERE NOT EXISTS (SELECT 1 FROM Intervals i WHERE d.dValue BETWEEN i.ivFrom AND i.ivTo)


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Strange performance boost by query rewrite

    I'd try adding IvTo to that clustered index on IvFrom. Guessing wildly, both versions of the query would take about the same time, and rather less than you're currently getting....


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

Viewing 15 posts - 886 through 900 (of 1,228 total)