Forum Replies Created

Viewing 15 posts - 3,751 through 3,765 (of 4,085 total)

  • RE: Product level to low

    The first error is probably caused by using an old version of dtexec. This will happen if you have both the SQL 2000 and SQL 2005 client tools installed...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: NULL Dates

    Stephen_W_Dodd (4/22/2011)


    UPDATE table SET dtField = NULL WHERE dtField = 0

    or maybe

    UPDATE table SET dtField = NULL WHERE dtField = 0 Or dtField = '' ?

    Remember dtField represents a...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Urgent-------Export all tables in a schema to multiple textfiles in a pipe delimited format

    You could also try the undocumented stored procedure sp_msforeachtable.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Returning multiple fields in a subquery based on each row of the master query.

    You have a couple of choices. In this case, a CROSS APPLY is probably going to perform best, but you may find that a CTE with ROW_NUMBER() will perform...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Stored Procedure/Function Calculation Optimization

    First, you have to remember that SQL is optimized for set-based operations while the language that you are translating from is most likely primarily a procedural language. Translating directly...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: User Defined Functions returning variable length strings

    From books online

    User-defined functions cannot be used to perform actions that modify the database state.

    The datatype returned by a function is part of the database state, so you can't write...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Trying to Omit Columns With Zero Sum

    You're probably better off doing this in the presentation layer rather than in T-SQL. For instance, this is easy to do in SSRS by specifying the visibility property of...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Trailing spaces in WHERE-Clause

    opc.three (3/17/2011)


    Using a binary collation was my initial thought. I suspect that adding the check for datalength will be slower than using the collation method but have not tested out...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Searching a column for a word

    David Burrows (3/17/2011)


    Try this

    LIKE '%rate[!"'',.:;? ]%'

    You can add additional chars between [] but check LIKE and PATINDEX on BOL (Books Online) for special chars and how to ESCAPE them.

    You are...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: XML Grandchild Nodes - How to query?

    The problem is that you are using absolute paths on the original column when you should be using relative paths on the derived columns.

    SELECT stores.detail.value('(StoreName)[1]', 'varchar(50)') AS store_name

    ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Columns to Row?

    jason-772533 (3/14/2011)


    Hi Drew, Therein lies a small problem. I'm using a 2000 server, so can't use ROW_NUMBER as it's 2005 syntax!

    There is a separate forum for SQL 7.0/2000...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Columns to Row?

    You'll probably want to use the ROW_NUMBER() partitioned by the Category for determining the columns. Before pivoting you'll have

    A Aardvark 1

    A ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Creating nested xml tree

    I'm not sure about other tools, but I've found that for creating complex XML structures using T-SQL, you're better off using FOR XML EXPLICIT instead of any of the other...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Last 2 months Last working date

    SELECT Convert(varchar(25), Max(dt), 100)

    FROM #Temp

    WHERE DateDiff(Month, dt, Getdate()) BETWEEN 1 AND 2

    GROUP BY DateDiff(Month, dt, Getdate())

    ORDER BY Max(dt)

    I personally would return the dates in datetime format, rather than converting them...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Calculating percentage issue

    Because they appear in the SELECT clause instead of the FROM clause the aliases a, b, and c are column aliases, but you are trying to treat a and b...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,751 through 3,765 (of 4,085 total)