Forum Replies Created

Viewing 15 posts - 571 through 585 (of 14,953 total)

  • RE: What's the best way to pass parameter into a dynamic sql in my case? Thanks.

    First, is @sql defined as varchar, or nvarchar? Needs to be unicode for this (nvarchar).

    Second, you need to provide sp_executeSQL with (at least) 3 things in order to use...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: CONVERT BEHAVIOUR

    1D2 is a version of scientific notation, 1 times 10 to the 2nd power. Try 1.234D3. Try an E instead of a D, too.

    Int doesn't like any of...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Trying to combine two sql statements

    For this kind of "look in every database" script, using a cursor to step through the list of databases you want is usually your best bet.

    Since you would need to...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: What's the best way to pass parameter into a dynamic sql in my case? Thanks.

    You'd have to define the variable inside the scope of the Exec command in order to do it that way. You're better off using sp_executeSQL instead.

    EXEC sp_executeSQL 'Select DocID,...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: CONVERT BEHAVIOUR

    Try converting "1D2" to Int and Float, while you're at it. That's one of the ones I use to show weaknesses in the IsNumeric() function.

    SELECT CAST('1D2' AS FLOAT);

    GO

    SELECT CAST('1D2'...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Login failed for user ''. Reason: An attempt to login using SQL authentication failed. Server is configured for Windows authentication only.

    Probably a flaw in the error-handling code in the engine. Throws an error (correctly) for a blank login, but the error message is either the wrong one, or is...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: CONVERT BEHAVIOUR

    There are a few strings that are treated differently by Int conversions vs Float conversions. It's probably as simple as different teams worked on the two pieces of code,...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Please explain the difference between "Parameter Sniffing and With Recompile"

    There's a very good article on Gail Shaw's blog: http://sqlinthewild.co.za/index.php/2007/11/27/parameter-sniffing/

    Read that and see if it answers your questions. It's quite helpful to most people with questions about these things.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: I have a dilemma

    Does the query do anything other than return raw data from one table? Aggregations (min, max, avg, that kind of thing), running totals, pulling data from complex multi-table structures;...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: How many rows in a table before using a clustered index?

    scogeb (11/5/2012)


    GSquared (11/3/2012)


    scogeb (11/2/2012)


    I like to think there is always an exception to every rule. Take for instance a table that ALWAYS has inserts and NEVER has any selects....

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: How many rows in a table before using a clustered index?

    Jeff Moden (11/3/2012)


    ScottPletcher (11/2/2012)


    Given that a clustered index doesn't cost you much space (just for the upper/non-leaf levels of the index), I tend to cluster log tables as well. However,...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: How many rows in a table before using a clustered index?

    scogeb (11/2/2012)


    I like to think there is always an exception to every rule. Take for instance a table that ALWAYS has inserts and NEVER has any selects. Putting...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Do i need to drop temp tables ?

    Jeff Moden (11/3/2012)


    KcV (11/2/2012)


    Hi,

    I have a SP in which i create 3 temp tables. and get result from those tables. But at the end of sp do i need to...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: How many rows in a table before using a clustered index?

    GilaMonster (11/2/2012)


    Stewart "Arturius" Campbell (11/2/2012)


    Clustered indexes are best suited for those columns most frequently used in range-based searches.

    I would tend to disagree with that, but that's just me.

    Not just you.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Removing unwanted space in the result of SELECT query

    Are you trying to do something like this:

    IF OBJECT_ID(N'tempdb..#T') IS NOT NULL

    DROP TABLE #T;

    CREATE TABLE #T (

    Col1 VARCHAR(100));

    INSERT INTO #T(Col1)

    VALUES ('A ...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 15 posts - 571 through 585 (of 14,953 total)