Viewing 15 posts - 91 through 105 (of 137 total)
You can use an 'INSTEAD OF' trigger. For optimal performance, you could also store the current maximum in an other table. Example below uses select max() to get the current...
June 29, 2004 at 12:56 am
You can find the info you need in the master.dbo.spt_values table. Following script lists all indexes that will be uniqe ( unique, primary key or unique key ). I got...
June 29, 2004 at 12:19 am
I suppose the variables @sdate and @edate are parameters. I had the same type of problem in my procedures. Make sure the optimiser has correct values for @sdate and @edate the...
June 16, 2004 at 12:18 am
You could create a sp_ stored procedure in the master database. sp_ stored procedures in master can be called from any database, and are the only type of...
June 15, 2004 at 1:45 am
I found the same type of problem on this site http://www.sqlservercentral.com/forums/shwmessage.aspx?messageid=113712 and there is a link to a fix ...
June 7, 2004 at 1:48 am
There is no easy way to do this. I would suggest to script the creation of the system function into an other file, and do something like this : (...
May 28, 2004 at 1:35 am
If you know the name of the identity column, you can do something like this :
-- drop table tst drop table #tst
go
create table tst
(
i int identity(1,1),
j varchar(10),
k...
May 27, 2004 at 12:23 am
The best way to do is to pass your scripts file through a Preprocessor ( like for compiling C programs ). Just define a macro IFF(a,b,c) as case when a...
May 26, 2004 at 6:13 am
Could you try this :
SELECT name,
next_run_date,
next_run_time,
DateDiff(Day, CAST (next_run_date AS VARCHAR(8)), getdate()) as Days,
DateDiff(hour,CAST(next_run_date as varchar(8)) + ' ' + right('00' + CAST((next_run_time/10000) as varchar(2)),2) + ':' + right('00' + CAST((next_run_time/ ...
May 24, 2004 at 12:43 am
You can change the sp_rename stored procedure ( in master ), and comment the line with
raiserror(15477,-1,-1)
I would suggest to create a new (system) stored procedure sp__rename, as a copy...
April 21, 2004 at 5:54 am
You could use the datediff function like this :
DELETE FROM TableX x
WHERE DATEDIFF(dd,x.DateFields,getdate()) > 21
April 15, 2004 at 2:29 am
I would do it like this, to make sure the inported rows stay in the same order :
if object_id('tempdb..#xpcmd') is not null drop table #xpcmd
go
create table #xpcmd ( id int...
April 8, 2004 at 6:00 am
This seems OK to me . You could add begin/commit transaction to make sure you do not insert the same source and IncidentNo twice....
April 8, 2004 at 1:22 am
You need this :
Insert into TableX
Select Y.Col1, Y.Col2
From TableY Y
where Not Exists (Select 1 From TableX X Where X.Col1 = Y.Col1 and X.Col2 = Y.Col2)
April 7, 2004 at 1:37 am
It can be done in different ways. I do it by creating the same stored procedure in each database, and have the database I want the data from as a...
April 7, 2004 at 1:19 am
Viewing 15 posts - 91 through 105 (of 137 total)