Forum Replies Created

Viewing 15 posts - 916 through 930 (of 6,486 total)

  • RE: BEGIN TRY/CATCH in a MERGE Statment with OUTPUT to capture Record Counts

    Sean Lange (7/24/2012)


    True and good reminder. You could however do something like this:

    update blah

    set mycol='SomeNewValue'

    output @@rowcount

    (snipped for brevity)

    Neat idea, but unfortunately it doesn't seem to...

  • RE: BEGIN TRY/CATCH in a MERGE Statment with OUTPUT to capture Record Counts

    Sean Lange (7/24/2012)


    This thread has a good example of using OUTPUT with MERGE.

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

    There is nothing magical about try/catch blocks in t-sql. They work just like the same constructs in every...

  • RE: convert to binary

    GSquared (7/23/2012)


    If they're strings, something like this is what's needed:

    (snipped)

    Or - since 2008, you can simply use CONVERT:

    select convert(bigint,CONVERT(varbinary(32),'20120DB8AC10FE01',2))

    That said - your best bet in this case might simply be...

  • RE: Catching the exact error record.

    One more option: if you have a way to actually "walk" the input file, you could create smaller batches to import. Then walk through the import in batches, and...

  • RE: Catching the exact error record.

    arun1_m1 (7/14/2012)


    Sorry Matt, cannot move over to use SSIS.:crying:

    Then the next answer is to know WHAT would cause insert errors. Tables have a definite structure, with definite constraints, so...

  • RE: Catching the exact error record.

    Sean Lange (7/13/2012)


    Well that doesn't really solve the OP's issue. They have an insert and want to know which line in the data is causing the issue. I modified your...

  • RE: Case not reacting to NULL's

    Don't use =, use:

    data1 IS null

    null isn't a value, it's a state (the state of something with no value) , so equality will never return TRUE.

  • RE: Find Averages ignoring high/low values

    2Tall (7/13/2012)


    Hi. So current output as per your post. I would like to look as follows:

    Product..........Manufactured Qty...........Process..................Total Time......Avg Time Booked (hours)

    1-FAU440A..............4........................ASSEMBLY...............62.................3.64

    ......................................................INSPECTION.............3.75..............0.93

    ......................................................STORES/DISPATCH....15.5..............5.16

    ......................................................TEST......................30.5..............2.77

    1-FAU440B..............4........................ASSEMBLY..............3.25...............0.81

    ......................................................INSPECTION............1.25...............0.31

    ......................................................TEST.....................38..................2.71

    Strictly speaking that's not all of it as I have...

  • RE: Import XML Data into SQL tables

    You probably will want to find out where the mixed content actually is. Mixed content tends to be problematic no matter what in just about any xml handling, since...

  • RE: Subtracting a Millisecond...

    dkschill (7/12/2012)


    Need to learn to let go, and use DATETIME2...

    Works fine when converted to DATETIME2 instead of DATETIME.

    Found my answer here:

    http://msdn.microsoft.com/en-us/library/ms187819.aspx

    Time range

    00:00:00 through 23:59:59.997

    This might give you a...

  • RE: Primary Key update

    Kingston Dhasian (7/12/2012)


    Try the below steps:

    1. Update the appropriate NOLIVRE and CODEEMPLACEMENT in Inventaire first to NULL

    2. Update the appropriate CODEEMPLACEMENT column in LivreEmplacement table by using your query

    3. Update...

  • RE: Updating Unique Sequential NUmber

    Lynn Pettis (7/11/2012)


    This works as well:

    CREATE TABLE [dbo].[TEST1](

    [ID] [VARCHAR](10) NULL,

    [VALUE] [int] NULL

    );

    GO

    INSERT INTO dbo.TEST1 (ID, VALUE) SELECT 1, 10;

    SELECT 'PRE' LABEL1, * FROM dbo.TEST1;

    DECLARE @SAVE1 INT;

    UPDATE dbo.TEST1 SET

    ...

  • RE: Flattening XML problem

    Sure. Would be happy to review it. Send me what you have whenever you're ready.

  • RE: Advice on Bitwise Comparison

    I'm getting lost in your requirements, but you definitely don't need the cursor.

    ; with basecte as (

    select FirstGroupingId,CheckID,faillevel

    , sum(case when charindex(CheckValue,TextData) > 0 then 1 end) status

    from #base_data cross join...

  • RE: Fill variable from cursor

    The cursor aspect has already been discussed at length (i.e. avoid them like the plague).

    That said - you're using CASE incorrectly, which is what is causing the error. If...

Viewing 15 posts - 916 through 930 (of 6,486 total)