Forum Replies Created

Viewing 15 posts - 15,016 through 15,030 (of 15,381 total)

  • RE: Delete from the same table in mutiple databases

    Just fyi, you can use to single tick marks inside a string.

    '.dbo.YourTableName where YourColumn < ' + CHAR(39) + '1/1/2011 12:00:00 AM' + CHAR(39)

    is the same thing as

    '.dbo.YourTableName...

  • RE: Error types

    An interesting question. I would suggest that using try-catch would be better regardless of the outcome of the unhandled exception being thrown. Handle the exception, log it so you know...

  • RE: looking for a solution (script) to automate Report

    Helal, welcome to sqlservercentral. In order for us to help you, you first need to help us. Please see the link here[/url] for examples on how to post your questions...

  • RE: Irritating Bug/feature?

    LOL no problem. I too hated that until I figured out how to get it to refresh. It really makes sense that SSMS would not be checking everytime some sql...

  • RE: Irritating Bug/feature?

    [control] + [shift] + [r]

    This will refresh the intellisense.

  • RE: Trouble with DML Trigger

    Point is that AlertID is not part of the command table. Remember your primary key violation is on the command table, the insert into AlertLog is ok.

    Your insert

    DTRaised =...

  • RE: Trouble with DML Trigger

    That is it. Take a look at what columns you are using for inserts in your trigger.

  • RE: Trouble with DML Trigger

    Best of luck. I would suggest coming up with a key that will guarantee uniqueness. Basically what you are doing is counting on the time to be your last step...

  • RE: Trouble with DML Trigger

    From your very set of inserts it fails on this one

    INSERT [dbo].[AlertLog]([AlertID],[TreaterID],[DTRaised],[Description],[Priority]) VALUES (3,1,'2/5/2011 10:28:31 AM','Seed Wheel Motor Alert','High')

    because there is already a record in command with that primary key.

    The...

  • RE: Trouble with DML Trigger

    There seems to be some key issues. You are using portions of other fields to make up one part of your composite key.

    cast(TreaterID as varchar(5)) + '-' + cast(BatchID...

  • RE: Trouble with DML Trigger

    OK that's what I thought. The problem is not really with the trigger itself. You are inserting into a table of records that can be inserted into from any of...

  • RE: Trouble with DML Trigger

    Do you have similair triggers on other tables? I have noticed that you have mentioned this trigger in relation to at least 3 tables throughout this thread.

  • RE: Trouble with DML Trigger

    I would think you don't want a rollback unless there is something else I am missing. A rollback would rollback all the stuff you just did.

  • RE: Trouble with DML Trigger

    Something like this

    Insert into Command ([Requested],[TableID],[RecordID],[Command],[RetriesAttempted],[Cancelled])

    Select DTCreated, '3', cast(TreaterID as varchar(5)) + '-' + cast(BatchID as varchar(5)), '0', '0', 'False'

    ...

  • RE: Evaluating Spaces

    Before you try to write your own split function you should take a look at Jeff Moden's here.

Viewing 15 posts - 15,016 through 15,030 (of 15,381 total)