Viewing 15 posts - 15,016 through 15,030 (of 15,381 total)
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...
February 17, 2011 at 3:27 pm
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...
February 17, 2011 at 3:13 pm
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...
February 17, 2011 at 3:01 pm
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...
February 17, 2011 at 2:53 pm
[control] + [shift] + [r]
This will refresh the intellisense.
February 17, 2011 at 2:45 pm
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 =...
February 15, 2011 at 1:37 pm
That is it. Take a look at what columns you are using for inserts in your trigger.
February 15, 2011 at 1:28 pm
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...
February 15, 2011 at 12:44 pm
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...
February 15, 2011 at 11:42 am
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...
February 15, 2011 at 9:06 am
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...
February 15, 2011 at 8:15 am
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.
February 15, 2011 at 7:44 am
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.
February 14, 2011 at 9:47 am
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'
...
February 14, 2011 at 9:35 am
Before you try to write your own split function you should take a look at Jeff Moden's here.
February 11, 2011 at 1:43 pm
Viewing 15 posts - 15,016 through 15,030 (of 15,381 total)