Viewing 15 posts - 691 through 705 (of 1,491 total)
To avoid typos when replacing DBs from backups with the same logcal file names, I tend to generate the MOVEs with the following:
-- To generate MOVEs from dest DB
SELECT ',MOVE...
November 7, 2013 at 6:20 am
My experience is that JOINs in sub-queries soon become nested loops.
Also, using EXISTS sub-queries negates the need for a DISTINCT.
I would try something like:
WITH UpdID
AS
(
SELECT ID
FROM demogtable d1
WHERE d1.demogID =...
September 25, 2013 at 10:11 am
This is also quite old but worth reading:
September 16, 2013 at 10:36 am
Your key problem will be working out what the encoding is.
It is probably Base64. This site may help:
May 13, 2013 at 8:41 am
I think sp_start_job is one of the SPs which do not throw errors but return a status code instead.
Try:
DECLARE @RetVal int;
EXEC @RetVal = msdb.dbo.sp_start_job N'TestJob';
IF @RetVal > 0
RAISERROR(N'TestJob failed to...
May 8, 2013 at 9:40 am
Using the Windowed functions (ROW_NUMBER, RANK etc), is normally the easiest way to resolve this type of query.
-- *** Test Data ***
-- You should provide test data in this format...
October 4, 2012 at 6:07 am
Locks are acquired by a SQL connection.
If one connection acquires an X lock on a table that connection can still do a SELECT; it is just other connections that will...
August 23, 2012 at 4:01 am
CREATE TABLE dbo.MyTable
(
MasterIp varchar(255) NOT NULL
CONSTRAINT PK_MyTable PRIMARY KEY
,status1 tinyint NOT NULL
,status2 tinyint NOT NULL
,Active_status tinyint NOT NULL
)
GO
CREATE TRIGGER TR_MyTable_IU
ON dbo.MyTable
AFTER INSERT, UPDATE
AS
IF @@ROWCOUNT = 0 RETURN;
SET NOCOUNT ON;
-- Rows...
July 11, 2012 at 6:07 am
I do not understand your results, but the following should get you started:
-- *** Test Data ***
CREATE TABLE #t
(
TransactionId int NOT NULL
,SellDateTime datetime NOT NULL
);
INSERT INTO #t
VALUES (1, '20120612 09:30')
,(2,...
June 12, 2012 at 8:50 am
ALZDBA (4/18/2012)
keep in mind to also check your inserted set for duplicates.
I was half thinking that for my original version but of course it is an AFTER trigger so one...
April 18, 2012 at 8:45 am
The trigger should be:
SET ANSI_NULLS, QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER dbo.TR_tblProduct_PRCode
ON dbo.tblProduct
AFTER INSERT,UPDATE
AS
SET NOCOUNT ON;
BEGIN TRY
IF EXISTS
(
SELECT 1
FROM inserted
WHERE COALESCE(PRCode, '') = ''
)
RAISERROR ('No PR Code.', 17,1);
IF EXISTS
(
SELECT P.PRCode
FROM dbo.tblProduct P
WHERE...
April 18, 2012 at 6:57 am
SET ANSI_NULLS, QUOTED_IDENTIFIER ON
GO
--CREATE TABLE dbo.Exceptions
--(
--ExceptionId int IDENTITY(1,1) NOT NULL
--CONSTRAINT PK_Exceptions PRIMARY KEY
--,ExceptionDate datetime NOT NULL
--,ErrorNumber int NOT NULL
--,ErrorSeverity int NOT NULL
--,ErrorState int NOT NULL
--,ErrorProcedure nvarchar(126) NOT NULL
--,ErrorLine int NOT...
April 18, 2012 at 5:54 am
I am not sure if this process this is a good idea. (Data security etc)
If you really want to do it, you could look at creating a job on the...
March 15, 2012 at 6:24 am
The way to do these conversions is to follow the WHERE clause and remember that the *, in the *=/=*, is against the table where all the rows are to...
March 15, 2012 at 6:05 am
david.moule (3/7/2012)
March 7, 2012 at 7:29 am
Viewing 15 posts - 691 through 705 (of 1,491 total)