Forum Replies Created

Viewing 15 posts - 2,281 through 2,295 (of 3,543 total)

  • RE: Datetime problem in transform data task

    Try it like this

    if DTSSource("Col009") = null then

        DTSDestination("Col009") = null

    else

        DTSDestination("Col009") = mid(DTSSource("Col009"),1,4) & "/" & mid(DTSSource("Col009"),5,2) & "/" & mid(DTSSource("Col009"),7,2) & " " & mid(DTSSource("Col009"),9,2) & ":" &...

  • RE: Nested Transactions

    I'd be interested in comments this this

    I only use single transactions whether or not I call multiple procedures.

    And if BOL (SQL2K) is to...

  • RE: Datetime problem in transform data task

    Date transformation in DTS is not very forgiving and either poorly formatted dates or low value years will cause problems.

    In the transformation delete the 'copy column' transformation for the field and...

  • RE: convert a roow of data under a single column heading

    SELECT [Number 1] AS [Number] FROM [Number} WHERE [ID] = 1

    UNION ALL

    SELECT [Number 2] AS [Number] FROM [Number} WHERE [ID] = 1

    UNION ALL

    SELECT [Number 3] AS...

  • RE: periods of dates

    OK, so you did not like solution then

    The Calendar table contains each date in the input range (built for each query) or a...

  • RE: periods of dates

    SELECT CASE

    WHEN (DATEDIFF(day,@fromdate,@until) + 1) - SUM(DATEDIFF(day,

              CASE WHEN @fromdate < fromdate THEN fromdate ELSE @fromdate END,

              CASE WHEN @until > until THEN until ELSE @until END...

  • RE: periods of dates

    DECLARE @fromdate datetime, @until datetime

    SET @fromdate = '2005-07-07'

    SET @until = '2005-07-14'

    SELECT (DATEDIFF(day,@fromdate,@until) + 1) - SUM(DATEDIFF(day,

    CASE WHEN @fromdate < fromdate THEN fromdate ELSE @fromdate END,

    CASE...

  • RE: Openrowset query

    Add extra property to connection string, e.g.

     'Excel 8.0; DATABASE=c:\MyData.xls;HDR=YES'

    will use first line of worksheet as column names

     'Excel 8.0; DATABASE=c:\MyData.xls;HDR=NO'

    will process the first line the same as the rest (as data)...

  • RE: Openrowset query

    see

    http://www.sqldts.com/default.aspx?254

    whilst it refers to DTS the problem is the same

  • RE: to find the maximum of a integer column of a table using a function

    To find the result you are looking for requires the use of dynamic sql which cannot be used in a function, only in a procedure like this

    CREATE PROCEDURE usp_GetMaxValue

       ...

  • RE: convert varchar to float

    I suggest checking the varchar data as the data content will most likely give you the 'Error converting varchar to float' error.

    e.g. '-' or '.1' will give you the error

  • RE: Dynamic column count

    Try adding grouping like this

    SELECT @strSQL = 'SELECT ProductID, ProductName, '

    WHILE @i <= @t

    BEGIN

    SET @strSQL = @strSQL +

    'MAX(CASE CategoryID WHEN ' +

    CONVERT(nvarchar,@i) +

    ' THEN 1 ELSE 0...

  • RE: LessThanGreaterThan on a string

    This might do it

    DECLARE @From nvarchar(250), @To nvarchar(250)

    SET @From = N'Cat'

    SET @To = N'Eva'

    SELECT *

    FROM EMPLOYEE

    WHERE LEFT([NAME],LEN(@From)) >= @From

    AND LEFT([NAME],LEN(@To)) <= @To

    but performance...

  • RE: How do I form this SQL-

    SELECT a.somereference, a.[date], a.[time], a.status, a.owner

    FROM #Table a

    INNER JOIN (

    SELECT x.somereference, MAX(CAST('1904 '+x.[date]+' '+x.[time] as datetime)) AS [MaxDate]

    FROM #Table x

    GROUP BY somereference

    ) b

    ON...

  • RE: Custom Sort

    This assumes a maximum of four values with either hyphen or full stop delimiter and a maximum of 4 chars between delimiters

    ORDER BY 

    ISNULL(RIGHT('0000'+PARSENAME(REPLACE([column],'-','.'),4),4),'')+

    ISNULL(RIGHT('0000'+PARSENAME(REPLACE([column],'-','.'),2),4),'')+

    ISNULL(RIGHT('0000'+PARSENAME(REPLACE([column],'-','.'),3),4),'')+

    ISNULL(RIGHT('0000'+PARSENAME(REPLACE([column],'-','.'),1),4),'')

Viewing 15 posts - 2,281 through 2,295 (of 3,543 total)