Forum Replies Created

Viewing 15 posts - 16 through 30 (of 212 total)

  • RE: Encryption/Decryption

    This statement simply encrypts EXISTING SSNs:

    OPEN SYMMETRIC KEY Key_01

    DECRYPTION BY CERTIFICATE DatabaseA01

    UPDATE dbo.TableA

    SET SSN = ENCRYPTBYKEY(KEY_GUID('Key_01'), SSN)

    CLOSE SYMMETRIC KEY Key_01

    If new records are being encrypted as they are added, you...

  • RE: Encryption/Decryption

    Encryption on a column can't be 'turned off.' It's the values in the field that are encrypted, not the column itself. You are probably storing the encrypted SSNs...

  • RE: Calling Throw within If block

    Here's an example without a TRY...CATCH block:

    IF 1=1

    BEGIN

    ;THROW 51000, 'The record does not exist.', 1;

    END

  • RE: Calling Throw within If block

    "The statement before the THROW statement must be followed by the semicolon (;) statement terminator."

    Try putting a semicolon right before the THROW statement, like:

    BEGIN CATCH

    ;THROW

    END CATCH

  • RE: XML Question

    Yes. You can also do it inline like this:

    SELECT

    xml_column.query('declare namespace ns="http://webservice.nada.com/"; data(//VehicleValue_Struc/ns:VehicleYear)[1]') AS vehicle_year

    FROM

    vehicles

    WHERE

    id = 10

    And you are welcome 😀

  • RE: XML Question

    ;WITH xmlnamespaces (N'http://webservice.nada.com/' as ns)

    SELECT

    xml_column.value(N'(//VehicleValue_Struc/ns:VehicleYear)[1]',N'nvarchar(100)') AS vehicle_year

    FROM

    vehicles

    WHERE

    id = 10

    OR:

    ;WITH xmlnamespaces (N'http://webservice.nada.com/' as ns)

    SELECT

    xml_column.query(N'data(//VehicleValue_Struc/ns:VehicleYear)[1]') AS vehicle_year

    FROM

    vehicles

    WHERE

    id = 10

  • RE: Transaction Isolation Level based on Login

    You could set up a login trigger to fire a proc on login that contained appropriate logic. However, any other procs that were executed by a login may have...

  • RE: Pass an unknown number of values to a function

    BGM (5/24/2012)


    err.. thank you for being so terse? :hehe:

    I guess the obvious follow up question is how the crap does checksum() work then? 😉

    Cheers!

    I think this might give you some...

  • RE: BAK/TRN Cleanup question

    I would expect a single transaction log backup when using APPEND, and I'd expect the transaction log backup to grow each hour, until it was replaced by a new backup...

  • RE: Working with DATETIME Functions

    SELECT datediff(mm, dateadd(mm, 48, ADOPTION), getdate()) AS MonthsPastDue

    FROM EOP

  • RE: Table data Corrupted

    Do you have a backup? Have you tried the REPIAR_ALLOW_DATA_LOSS option with DBCC CHECKTABLE? If you have a current backup, I would restore the database to a NEW...

  • RE: Trim String

    bpowers (5/15/2012)


    The problem I am trying to code out, is that the length of the string will grow over time. However, as it grows I want strip off the first...

  • RE: Merge

    Yes - when you use the 'WHEN NOT MATCHED BY' clause, you have to use the keywords 'SOURCE' or 'TARGET'. However, it's ok to alias your actual table names...

  • RE: CTE convert zip table to a string

    kf2012 (5/11/2012)


    Sorry I am a newbie in CTE and have seen this:

    http://www.sqlservercentral.com/articles/CTE/67974/

    A script for doing what I asked would be greatly appreciated.

    Thanks.

    Why do you have to use a...

  • RE: CTE convert zip table to a string

    What have you tried so far?

Viewing 15 posts - 16 through 30 (of 212 total)