Viewing 15 posts - 18,721 through 18,735 (of 18,926 total)
First of all you need dynamic sql to do this.
Second, I see you are assuming that all nVarChar columns in your database are size 50. This tells me that...
January 5, 2005 at 1:55 pm
I just made a little search on my previous question and here's the best link I found.
http://vyaskn.tripod.com/differences_between_set_and_select.htm
And I'm sorry to contradict you Aj but none of your 5 points were...
January 5, 2005 at 1:18 pm
You could use a simple after insert trigger then.
Create trigger ....
FOR INSERT
AS
SET NOCOUNT ON
if select count(*) from MyTable = 1
begin
rollback tran
raiserror ('can''t have more than one row in this...
January 5, 2005 at 12:49 pm
I actually thaught over my answer and realised you could simply add 1 trigger (instead of 2) like so :
CREATE TRIGGER [trTest_IO_IUD] ON [dbo].[Test]
INSTEAD OF INSERT, DELETE
AS
SET...
January 5, 2005 at 11:16 am
Steve, why do you preffer my first option?
Is it because you can send back an error message or because you have less code to maintain, maybe some other reason?
January 5, 2005 at 11:12 am
Please answer this so we can help you :
Do you want to drop existing columns from the table?
or
Do you want to delete information in certain columns?
or
Do you want to...
January 5, 2005 at 11:04 am
What exactly are you trying to accomplish in this sub. And what lines are you trying to keep and in what table?
January 5, 2005 at 9:51 am
Well it's one of 2 ways.
In the instead of insert trigger, you simply don't insert the rows in the table and return an error message saying no row can be...
January 5, 2005 at 9:49 am
That works... just be sure you remember the password you set there, cause it's a pain in the ass if you forget it.
January 5, 2005 at 8:21 am
This is as set based solution for the same probleme.
I've tested it's speed and it goes 2 to 10 times faster than the original script depending on the length of...
January 5, 2005 at 7:50 am
You'd need something like this :
CREATE PROCEDURE [dbo].[ProcTest]
AS
Exec dbo.Proc1
Exec dbo.Proc2
GO
Proc2 will execute once proc1 is done running.
January 5, 2005 at 6:44 am
I would think so.. try this
set @cmd = 'USE DELTEKCP' + char(13) + char(10) + 'GO' + char(13) + char(10) + 'sp_grantdbaccess ' + @loginame + ', ' +...
January 4, 2005 at 2:42 pm
Can you explain why set is better than select.
I've already run tests and the speed is exactly the same.
The only difference is when you use :
Select @v1 = 1,...
January 4, 2005 at 2:32 pm
CREATE TRIGGER [trTableA_Update] ON [dbo].[tableA]
FOR UPDATE
AS
SET NOCOUNT ON
If Update (ColName_That_Causes_Audit)
begin
Insert into TableB (Field1, Field2...) Select Field1, Field2... from Inserted
end
January 4, 2005 at 12:52 pm
Brian I can't find any case where your solution doesn't work... let me know if you find any but I don't see that hapenning.
Nice trick.
January 4, 2005 at 11:38 am
Viewing 15 posts - 18,721 through 18,735 (of 18,926 total)