Forum Replies Created

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

  • RE: Columns based on Date Range

    Crystal Reports has a crosstab object that was specifically designed for this type of operation. It's MUCH, MUCH easier to do this Crystal than in T-SQL.

    Drew

  • RE: How to return a date in Australian date format?

    Here are two different ways to do it.

    DECLARE @dateString DATETIME

    SET @dateString = '2012-04-05'

    SELECT @dateString,

    CASE WHEN DATEPART(DAY, @dateString) < 10

    THEN STUFF(CONVERT(varchar(10), @dateString, 103), 1, 1, '')

    ELSE CONVERT(varchar(10), @datestring, 103)

    END

    ,RIGHT(CONVERT(varchar(10), @dateString,...

  • 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...

  • 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...

  • 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...

  • 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. ...

  • 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...

  • 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...

  • 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...

  • 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...

  • 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...

  • 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,...

  • RE: junk characters in a field

    SELECT *

    FROM YourTable

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

    Drew

  • 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

  • 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...

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