Forum Replies Created

Viewing 15 posts - 181 through 195 (of 921 total)

  • RE: BUG Or What Am I Missing

    > It will also do this if you change the query to NOT EXISTS.

    use pubs

    select *

    from authors

    where state not in

    (select state

     from publishers)

    select *

    from authors...

  • RE: Declaring local variable larger than 8000 characters

    Use multiple output variables, each with a piece of the query being built, and then concatenate those variables in the EXEC() in the calling proc.

  • RE: How can i Modify/edit scripts?

    It wouldn't be too difficult to use DMO to script out the procedures (ORing SQLDMOScript_Drops), use your language to replace the column names, and then drop and recreate the relevant...

  • RE: Declaring local variable larger than 8000 characters

    From BOL:

    Use the string concatenation operator (+) to create large strings for dynamic execution. Each string expression can be a mixture of Unicode and non-Unicode data types.

    Although each [N] 'tsql_string'...

  • RE: Best choice for the allocation unit size

    Read-ahead is used when the pages should be contiguous (e.g. indexes and scans).  Pages not in the read-ahead range will not be cached, even if they're in the read extents. ...

  • RE: GETDATE -> only DATE needed

    If the YYYYMMDD value is a string, it will be implicitly converted to a date type.  If you instead use it as an integer, first convert the integer to a...

  • RE: Best choice for the allocation unit size

    Use 64K for the file system cluster size.  That helps performance even with OLTP as, even though disk I/O granularity is indeed 8K blocks, read-aheads use 64K extents.

  • RE: Switch Case statement in t-sql

    SELECT @test1 = CASE @a WHEN 0 then 'xyz' ELSE @test1 END, @test2 = CASE @a WHEN 1 then 'abc' ELSE @test2 END, @test3 = CASE @a WHEN 2 then 'lmn'...

  • RE: Auto shrink Tempdb

    That's an excellent question.

  • RE: Parameter to tweak to allow for greater tolerance for TIME-OUTS??

    If you mean a connection is timing out, that's set on the client side, not the server side.

  • RE: BUG Or What Am I Missing

    It's not a bug, it's what SQL is supposed to do.  Remember that NULL means "unknown".  This is a major reason to avoid using NOT IN with subqueries.  There was...

  • RE: Functions

    To get two values from one UDF, return a table:

    CREATE FUNCTION dbo.u_DaysAndPayDate(@fromdate datetime)

     RETURNS @t TABLE(Days tinyint, PayDate datetime) BEGIN

    DECLARE @d tinyint

    SET @d = 14 - DATEDIFF(d,'20031227',@fromdate) % 14

    SET @d =...

  • RE: GETDATE -> only DATE needed

    > So there may be a need to check input and update for that column (maybe trigger or other scheduled process).

      How about just...

  • RE: HELP FOR ADVANCED SELECT

    Not entirely clear on what you want; perhaps:

    SELECT a, SUM(CASE b WHEN 14 THEN 1 ELSE 0 END) b14s, SUM(CASE b WHEN 5 THEN 1 ELSE 0 END) b5s

    FROM Table

    WHERE...

  • RE: Problem with Querying Dates

    If there is a non-zero (i.e. non-midnight) time component to the date values, then your query will not find them.  Try something like:

    WHERE InsertDate >= '20040122' AND InsertDate < '20040123'

Viewing 15 posts - 181 through 195 (of 921 total)