Forum Replies Created

Viewing 15 posts - 3,226 through 3,240 (of 4,085 total)

  • RE: Columns based on Date Range

    While it's possible to do this in T-SQL, it's not the best tool for the job. Without knowing how you are planning to use these results, it's difficult to...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Urgent please help: Need the following.

    It sounds like you just want a count of the attributes. If that is the case, you don't need the string splitter.

    SELECT SUM(LEN(SelectedAttributes) + 1 - LEN(REPLACE(SelectedAttributes, '|', ''))

    FROM...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: fetching date from 1 sp to another

    Your design is fundamentally flawed. You're trying to use your stored procedure like a function. Here is what Microsoft has to say on the issue.

    Stored Procedure Basics


    Stored procedures...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Use one query to get two similar result sets in one

    You're essentially doing a pivot or crosstab and using any kind of join is an inefficient way of doing that. The following should get you what you need. ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: select statement

    Sean Lange (4/12/2012)


    Why are you so stubborn about posting ddl and sample data?

    I've come to the conclusion that he's not really interested in answers. He's only interested in monopolizing...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Referentail Integrity

    Gazareth (4/12/2012)


    Think Foreign Key REFERENCES Primary Key 🙂

    That's not quite accurate. The foreign key only needs to reference a unique key, it does not need to be the primary...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: select statement

    You already have another thread on this same topic. http://www.sqlservercentral.com/Forums/Topic1281058-392-1.aspx You didn't get the answer you wanted there, because you didn't provide the requested information. Starting a new thread...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Referentail Integrity

    pathankhan (4/12/2012)


    I can create only one foreign key constraint from Lookup_Country to Person_Information table but I have three columns that I need to setup referential integrity for... Is there any...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: trimming a string

    xenophilia (4/11/2012)


    when i run this:

    SELECT Distinct Outcome

    , TestNo

    , SUBSTRING(RIGHT('SuitePath',DATALENGTH('SuitePath') - 1),1,PATINDEX('%\%',RIGHT('SuitePath',DATALENGTH('SuitePath') - 1)) - 1)

    from testsuite

    i get this error

    Msg 536, Level 16, State 1, Line 1

    Invalid length parameter passed to...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: junk characters in a field

    Since the PATINDEX presumably includes a LIKE, it's bound to be less efficient. This is borne out by a comparison of the stats.

    LIKE

    (8 row(s) affected)

    Table 'XXXXXXXX'. Scan count 1,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: junk characters in a field

    SELECT *

    FROM YourTable

    WHERE YourField LIKE '%[^A-Z0-9]%'

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: select rows based on code

    hbtkp (4/11/2012)


    it doesnt matter , how do i get those value in select stm

    In that case, the answer you are looking for is here.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: select rows based on code

    hbtkp (4/11/2012)


    @ stands for group

    No, @ stands for the beginning of a variable/parameter definition. '@' may stand for group, but not @.

    i have group name item3 ,which i am...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: how to sum up instances only 3 of the 4 values that can occur in a given column

    Use a CASE statement.

    WITH TestSuite(Col1, Test, Outcome) AS (

    SELECT 1, 'test1', 'Passed' UNION ALL

    SELECT 2, 'test2', 'Failed' UNION ALL

    SELECT 3, 'test3', 'NotExec' UNION ALL

    SELECT 4, 'test4', 'Blocked' UNION ALL

    SELECT 5,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: select rows based on code

    You say that you are supplying one parameter, but you don't say what value you're supplying to that parameter.

    You say that name contains pen and pencil, but the data provided...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,226 through 3,240 (of 4,085 total)