Viewing 15 posts - 11,041 through 11,055 (of 15,376 total)
joshphillips7145 (8/8/2012)
So I changed it to a Instead Of trigger and it now prevents any entries from being inserted but no error, I just cannot figure out why!!:sick:
You changed...
August 8, 2012 at 12:42 pm
You are certainly pretty close. Here is a small little bit of help for working with triggers. They can be pretty difficult to debug because you can't just run it...
August 8, 2012 at 12:21 pm
Nope no offense taken. It seems that you still have some issues getting the information you want out of your query?
August 8, 2012 at 12:12 pm
And take the suggestions for indexes with a grain of salt. The suggestions are not always good ones. You need to test actual performance before and after adding those indexes.
August 8, 2012 at 9:59 am
Luis Cazares (8/8/2012)
Sean Lange (8/8/2012)
A couple other suggestions. You should not declare @Date as varchar and turn around and force implicit conversions to datetime.
I couldn't believe that @Date was declared...
August 8, 2012 at 9:43 am
Still no ddl or sample data? Honestly how do you expect anybody to be able to decipher this from what you have posted? We can't see the tables, we don't...
August 8, 2012 at 9:35 am
Please don't start a new thread for the same topic. Please direct all replies here. http://www.sqlservercentral.com/Forums/Topic1341216-392-1.aspx
August 8, 2012 at 9:28 am
A couple other suggestions. You should not declare @Date as varchar and turn around and force implicit conversions to datetime.
DECLARE @DATE VARCHAR(25)
SET @DATE = '2012-08-01 23:59:59'
Instead declare it as the...
August 8, 2012 at 9:14 am
You still need to look closer at the inserted and deleted virtual tables.
joshphillips7145 (8/8/2012)
August 8, 2012 at 8:57 am
joshphillips7145 (8/8/2012)
Create Trigger NoDuplicatesOn TestUniqueNulls
After Insert, Update AS
Begin
IF
(Select Count(*)
From TestUniqueNulls join TestuniqueNulls
On TestUniqueNulls.NoDupName = TestUniqueNulls.noDupName) > 1
Begin
RollBack Tran
RaiseError('Duplicate value', 11, 1)
End
End
That is reasonably close. Take a look at the...
August 8, 2012 at 8:52 am
This sounds a lot like homework. As such you will find people here willing to help guide you but not many that will provide you with code. The reason is...
August 8, 2012 at 8:10 am
No worries. It is hard to put your thoughts on "paper" in such a way that others can understand it. It seems that perhaps you read the article I suggested....
August 8, 2012 at 8:07 am
Nice of you to post DDL though Sean.
Thanks. Now if we can just the OP to clarify the question we can knock this out in about 3-4 minutes. 😛
August 8, 2012 at 7:58 am
You can't execute a query against a variable like that.
select @execquery = N'Select * from dbo.' + quotename (@tablename)
EXECUTE sp_executesql @execquery
This is where I am stumped. After I execute the...
August 7, 2012 at 3:48 pm
Viewing 15 posts - 11,041 through 11,055 (of 15,376 total)