Forum Replies Created

Viewing 15 posts - 1,021 through 1,035 (of 1,497 total)

  • RE: How to split on a double quote

    -- *** Test Data ***

    DECLARE @t TABLE

    (

    &nbsp&nbsp&nbsp&nbspLine varchar(50) NOT NULL

    )

    INSERT INTO @t

    SELECT 'UserLogon Logon "Domain\Username" from blah' UNION ALL

    SELECT 'Junk' UNION ALL

    SELECT '"Junk2' UNION ALL

    SELECT 'UserLogon Logon "Domain\Username2"'

    -- *** End...

  • RE: Removing Duplicates with condition - Help

    SELECT Acno, [Date], NodeName

    FROM

    (

    &nbsp&nbsp&nbsp&nbspSELECT ROW_NUMBER() OVER (PARTITION BY AcNo ORDER BY [Date] DESC) AS RowId

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp,Acno, [Date], NodeName

    &nbsp&nbsp&nbsp&nbspFROM YourTable

    ) D

    WHERE RowId = 1

    ORDER BY AcNo DESC

  • RE: Inserting records from multiple tables

    Derek – sorry for the confusion but my question was aimed at the OP as he seemed to be relying on the order the data was placed in the tables.

    My...

  • RE: Inserting records from multiple tables

    Do you realize that a table is an UNORDERED set?

    As long as you are prepared to order TableA by Id and TableB By Loc,

    which may not make sense with real...

  • RE: Primary Key Values

    DBCC CHECKIDENT (LineItem, RESEED, 240000000)

  • RE: UPDATE random column value in a loop for each row

    Very, very nice!

    I think the SELECT p.ID, p.theValue, p.theCol should be either:

    SELECT p.*

    or

    SELECT p.ID, p.bit01, p.bit02 ...

  • RE: UPDATE random column value in a loop for each row

    Make sure you have the semi-colon in front of the WITH.

    Also, make sure you are running on at least a SQL2005 machine with a DB in 2005 compatibility mode.

  • RE: How to add multiple columns into a new column

    1. You want to search for SQL String Concatenation. I have given you one technique.

    As string concatenation in TSQL is a bit of a fiddle you may want to return...

  • RE: How to add multiple columns into a new column

    Your schema is not very good but you can obtain your result like:

    -- *** Test Data ***

    DECLARE @bo-2 TABLE

    (

    &nbsp&nbsp&nbsp&nbspDDS char(2) NOT NULL

    &nbsp&nbsp&nbsp&nbsp,BOCleared int NOT NULL

    &nbsp&nbsp&nbsp&nbsp,BOClearedDate datetime NOT NULL PRIMARY KEY

    )

    INSERT...

  • RE: UPDATE random column value in a loop for each row

    This may be more random. It may be better to do this in the middle tier or with a cursor.

    -- *** Test Data ***

    DECLARE @t TABLE

    (

    &nbsp&nbsp&nbsp&nbspTId int IDENTITY NOT NULL...

  • RE: UPDATE random column value in a loop for each row

    This may not be particularly random.

    -- *** Test Data ***

    DECLARE @t TABLE

    (

    &nbsp&nbsp&nbsp&nbspTId int IDENTITY NOT NULL PRIMARY KEY

    &nbsp&nbsp&nbsp&nbsp,bit1 bit NOT NULL

    &nbsp&nbsp&nbsp&nbsp,bit2 bit NOT NULL

    &nbsp&nbsp&nbsp&nbsp,bit3 bit NOT NULL

    &nbsp&nbsp&nbsp&nbsp,bit4 bit NOT NULL

    &nbsp&nbsp&nbsp&nbsp,bit5...

  • RE: isolation level solution to unique index violation

    You only need to explicitly release the lock if you set it as a SESSION lock otherwise the it will last for the rest of duration of the connection.

    Thanks for...

  • RE: isolation level solution to unique index violation

    Robert - App Locks can be made to apply to the current session and not just the current transaction. It is then up to you to explicitly release the lock...

  • RE: isolation level solution to unique index violation

    As serializing will block inserts for other sessionIds, I would be inclined to use an

    application lock.

    (If the majority of your upserts are updates, I suspect replying on a CATCH block...

  • RE: SQL to output SQL

    After briefly scanning the post:

    1. GO is not a SQL command but a batch terminator in the tools. Try getting rid of it.

    2. @CRLF should be char(13) + char(10)

Viewing 15 posts - 1,021 through 1,035 (of 1,497 total)