Forum Replies Created

Viewing 15 posts - 8,476 through 8,490 (of 19,564 total)

  • RE: How to get date from String filed?

    Please provide your table structure (table create script).

  • RE: DateAdd function returns wrong result

    Lowell (9/28/2011)


    Jim i think it's because you mixed up the order of the parameters.

    ,dateadd(m,datediff(m,0,dateadd(m,1,getdate())),+3) As Date_3

    the "+3" in the above is a DATE...not the number of days to add. it's...

  • RE: DateAdd function returns wrong result

    Try this instead

    DECLARE @ThisDate DATETIME = GETDATE()

    Select

    @ThisDate As Date_1

    ,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0)+3 As Date_3

    ,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0)+2 As Date_4

    ,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0)+1 As Date_5

    ,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0) As Date_6

    ,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0)-1 As Date_7

    ,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0)-2 As Date_8

    ,dateadd(m,datediff(m,0,dateadd(m,1,@ThisDate)),0)-3 As Date_9

  • RE: How to get date from String filed?

    Yes - you can adapt this script to your actual table. However, you will still need the two subqueries inside that single select statement that has been provided.

    Just change...

  • RE: How to get date from String filed?

    The only reason for that table variable was due to the need to create a testable script.

  • RE: How to get date from String filed?

    Try this updated script:

    SELECT tabletext,RTRIM(LTRIM(Substring(deliveryText, start -1, length - start - fromEnd + 3))) AS [extracted]

    FROM (

    SELECT tabletext,MAX(PATINDEX([Matched], tableText)) AS start

    ...

  • RE: ORDER BY with one entry out of order

    Sean Lange (9/28/2011)


    GSquared (9/28/2011)


    select *

    from dbo.MyTable

    order by case Users when 'ALL' then 1 else 2 end, Users ;

    That avoids even things like entries that begin with low-ASCII-value punctuation coming...

  • RE: Find all Databases with Simple Recovery Mode

    In SQL 2000, the recovery model is not displayed in the system catalogue like it is in 2005. However, thanks to the magic of functions you can retrieve it...

  • RE: How to get date from String filed?

    Cadavre (9/28/2011)


    --Some test data first

    DECLARE @TABLE AS TABLE (tableText VARCHAR(1000))

    INSERT INTO @TABLE

    SELECT 'Some Product Name Here 3.7mmD X 8mmL (SBM)

    Product Code: 103708

    <span style="color:red;">Availability: 9/26/2011</span>'

    UNION ALL SELECT 'Some Product Name Here...

  • RE: identify applications using sa

    To capture the actual connection string you would need a packet capture.

    To get all the relevant information for the connection, try querying sys.dm_exec_sessions

  • RE: ORDER BY with one entry out of order

    Is there another field in the database (such as PK) that would help in sorting this data in the desired way?

  • RE: Backup DB structure

    Is the schema frequently changing?

  • RE: Today's Random Word!

    bcsims 90437 (9/28/2011)


    crookj (9/28/2011)


    Ray K (9/28/2011)


    stressed

    Ditto - Not a good week so far.....

    (But I do see the lgiht at the end of the tunnel)

    But is it the train at the...

  • RE: Today's Random Word!

    Daniel Bowlin (9/28/2011)


    crookj (9/28/2011)


    Ray K (9/28/2011)


    stressed

    Ditto - Not a good week so far.....

    (But I do see the lgiht at the end of the tunnel)

    The light at the end of the...

  • RE: Are the posted questions getting worse?

    GSquared (9/28/2011)


    SQL Kiwi (9/28/2011)


    WayneS (9/27/2011)


    • DBA Certification preferred in SQL Server versions 2000, 2005, and 2008.

    • ...

Viewing 15 posts - 8,476 through 8,490 (of 19,564 total)