Forum Replies Created

Viewing 15 posts - 256 through 270 (of 2,894 total)

  • RE: relative position of field in a recordset

    In T-SQL, you cannot refer to "a field" in a table by its "index".

    However, you can use dynamic sql o build a relevant update statement using table definition details...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Need help to build query

    Another way:

    SELECT S.*

    FROM SAMPLE S

    CROSS APPLY (SELECT MAX(dt) mxd, MIN(dt) mnd FROM (VALUES (a),(b),(c),(d)) as v(dt)) A

    WHERE A.mxd != A.mnd

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Find integer at end of a string. There *must* be a better solution ?

    I've couldn't run OP code in SQL2008 as he is using 2012 function.

    Now, I can see what is result of his query.

    The following will produce the same:

    select *

    ...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Audit log for INSTEAD OF DELETE trigger

    webrunner (7/25/2013)


    Thanks, Eugene, I see. I had commented out the ROLLBACK for my INSTEAD OF trigger so didn't understand the behavior you just posted with the test code. Perhaps Scott...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Audit log for INSTEAD OF DELETE trigger

    ScottPletcher (7/25/2013)


    Eugene Elutin (7/25/2013)


    Alexander Suprun (7/24/2013)


    Eugene Elutin (7/24/2013)


    RAISERROR cause transaction to rollback, so your log insert is rollbacked as well as delete...

    It's so untrue...

    RAISERROR has nothing to do with the...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Audit log for INSTEAD OF DELETE trigger

    webrunner (7/25/2013)


    Eugene Elutin (7/25/2013)


    webrunner (7/25/2013)


    ScottPletcher (7/24/2013)


    webrunner (7/24/2013)


    Alexander Suprun (7/24/2013)


    Remove ROLLBACK from the trigger and lower severity of RAISERROR to 10, in this case SSMS won't show any errors, rows will...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Audit log for INSTEAD OF DELETE trigger

    webrunner (7/25/2013)


    ScottPletcher (7/24/2013)


    webrunner (7/24/2013)


    Alexander Suprun (7/24/2013)


    Remove ROLLBACK from the trigger and lower severity of RAISERROR to 10, in this case SSMS won't show any errors, rows will disappear from the...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Why SQL Server converts '' to zero

    John Mitchell-245523 (7/25/2013)


    This indeed returns 0:

    SELECT CAST('' AS int)

    It's just the way it works. I suppose when the DBMS or the standards were being written, somebody decided that ''...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Find integer at end of a string. There *must* be a better solution ?

    Lowell (7/25/2013)


    doh!, if it ends in [0-9] might be even easier?

    SELECT *,

    CASE

    WHEN x LIKE '%[0-9]'

    THEN 1

    ...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Find integer at end of a string. There *must* be a better solution ?

    Lowell (7/25/2013)


    probably very similar, using reverse and patindex for the first non numeric character: from there, for the 1/-1, a case based on the len() would be what i would...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: audit my code for current request_id?

    ....

    is my code correct ah?

    ...

    Test it!

    If it's executes wihtout error that mean your code is valid.

    Check if results do match expected results. If so, your code is correct.

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: tsql function with dynamic number of parameters?

    The same question from past!

    You will see my response there too...

    http://www.sqlservercentral.com/Forums/Topic1305828-391-1.aspx

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Audit log for INSTEAD OF DELETE trigger

    Alexander Suprun (7/24/2013)


    Eugene Elutin (7/24/2013)


    RAISERROR cause transaction to rollback, so your log insert is rollbacked as well as delete...

    It's so untrue...

    RAISERROR has nothing to do with the transaction.

    It's just the...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Find integer at end of a string. There *must* be a better solution ?

    ...

    select *, ISNULL(CAST(SUBSTRING(x,NULLIF(PATINDEX('%-[0-9]%',x),0) + 1,1) AS INT),-1)

    from tmp

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: what is the use of IDENTITY data type?

    Koen Verbeeck (7/25/2013)


    Identity is not the data type, INT is.

    The identity property specifies that this column is autopopulated by an integer, starting at 1 and adding 1 for each new...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

Viewing 15 posts - 256 through 270 (of 2,894 total)