Forum Replies Created

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

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

    OK assuming by your first post that

    1. You do not know how many columns are in the table

    2. The numbers in the column names are not consecutive

    3. ID is always...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • 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) & ":" &...

    Far away is close at hand in the images of elsewhere.
    Anon.

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

    Far away is close at hand in the images of elsewhere.
    Anon.

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

    Far away is close at hand in the images of elsewhere.
    Anon.

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

    Far away is close at hand in the images of elsewhere.
    Anon.

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

    Far away is close at hand in the images of elsewhere.
    Anon.

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

    Far away is close at hand in the images of elsewhere.
    Anon.

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

    Far away is close at hand in the images of elsewhere.
    Anon.

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

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Openrowset query

    see

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

    whilst it refers to DTS the problem is the same

    Far away is close at hand in the images of elsewhere.
    Anon.

  • 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

       ...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • 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

    Far away is close at hand in the images of elsewhere.
    Anon.

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

    Far away is close at hand in the images of elsewhere.
    Anon.

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

    Far away is close at hand in the images of elsewhere.
    Anon.

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

    Far away is close at hand in the images of elsewhere.
    Anon.

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