Forum Replies Created

Viewing 15 posts - 1,051 through 1,065 (of 1,923 total)

  • RE: how many variables can I have?

    I would go with a single table with 2 columns.. Column 1 being the variable name and column 2 being value column.. Then u could make use of some SET-based...

  • RE: Getting Weekdays date between a specified date range

    How about this?

    DECLARE @StartDate DATETIME --= '2010-11-22'

    DECLARE @EndDate DATETIME --= '2010-12-22'

    SET @StartDate = '2010-11-22'

    SET @EndDate = '2010-12-22'

    ; WITH Tens (N) AS

    (

    SELECT 1

    UNION ALL SELECT 1

    UNION ALL...

  • RE: Pad nvarchar with trailing spaces

    How about this?

    SELECT Col1 + SPACE(32-LEN(Col1))

  • RE: Finding records clustered by date

    WayneS (11/3/2010)


    I think Monsieur ColdCoffee's code can be simplified - I don't think that the first CTE is necessary if in the second one, we order by the Activity in...

  • RE: Finding records clustered by date

    WayneS (11/3/2010)


    I think Monsieur ColdCoffee's code can be simplified - I don't think that the first CTE is necessary if in the second one, we order by the Activity in...

  • RE: Percentage value not appearing

    Richard Warr (11/3/2010)


    It will be to do with data types. You need one of the operands to be non-integer to get this to work. Try this:

    SELECT 665/12

    SELECT CAST(665 AS MONEY)/12

    ..and...

  • RE: Table Value Function

    mbender (11/3/2010)


    Also what is the difference between the IsNull and Coalesce?

    2 main differences

    1. Data-type precedence and conversion

    2. COALESCE can accept any number of input column, the...

  • RE: Finding records clustered by date

    Try this:

    DECLARE @PatientsInfo TABLE

    (

    PatientID VARCHAR(15),

    PatientCode VARCHAR(5),

    Activity DATETIME

    )

    INSERT INTO @PatientsInfo

    ...

  • RE: Incorrect syntax near 'dlf6'

    I guess, some of your DBs are having spaces in their names...

    Try changing part of your query to

    SELECT @SQL = '['+@DBName+']' + '..sp_HelpFile'

  • RE: datetime conversion error

    Dint you try cast and convert functions?

    select cast ( '6/9/2006' as datetime)

    select convert( datetime,'6/9/2006' )

  • RE: How does my concatenation UDF work?

    traughberk (10/27/2010)


    Thanks Drew, but it appears that the link you gave just points right back to this thread. I searched SSC for "quirky update" but didn't find any articles...

  • RE: separating a field of type date

    Try these:

    select CONVERT ( date , '12-14-2004 15:34:00')

    select CONVERT ( time , '12-14-2004 15:34:00')

    But, why would you want to do it ? Store dates fully!

  • RE: Can any one please guide,how to split this result,

    Chris Morris-439714 (10/22/2010)


    ColdCoffee (10/21/2010)


    Chris Morris-439714 (10/21/2010)


    ColdCoffee (10/21/2010)


    And i presume your EmpName does not have trailin/leading commas.. Else we will have to use another method.

    There's a trick for that...put them in...

  • RE: Conversion error even with correct data type

    The issue is with your "insert" statement.. If you do not provide the INSERT statement with the column names, it will insert the values as how it is in the...

  • RE: Can any one please guide,how to split this result,

    What about this?

    select reverse(stuff( reverse(stuff(@string,1,1,'')) ,1,1,''))

    Ugly, but still 😛

Viewing 15 posts - 1,051 through 1,065 (of 1,923 total)