Viewing 15 posts - 796 through 810 (of 1,494 total)
spidey73 (1/26/2011)
Server A: SQL 2008: contains the database on which the query is executed.
Server B: SQL 2005: the server from which the query is executed,
When I...
January 26, 2011 at 8:45 am
ntran777 (1/25/2011)
I need a proc that can make a variable number of temporary tables on the fly.
I would be interested in knowing why you need to do this. It...
January 26, 2011 at 8:16 am
To stop the race condition you will need to apply a key range lock on Jobs by making the select serializable.
(If this still gives problems add the update lock as...
January 24, 2011 at 7:31 am
There is a large section on Service Broker in BOL (Books Online).
January 19, 2011 at 10:38 am
You can get the same effect by creating a QUEUE and using Service Broker.
January 19, 2011 at 9:43 am
Maybe you want something like:
WHERE [state] =
CASE
WHEN @statefilter = 2
THEN 'CA'
WHEN @statefilter = 3 AND [state] = 'CA'
THEN 'ZZ' -- junk value
ELSE [state]
END
January 19, 2011 at 7:29 am
Could be network problems.
I would be inclined to to the backups onto a local share and then have them copied to the other server.
January 19, 2011 at 3:54 am
To pass a table variable you have to create a type and define the table as the type.
What you are trying to do will not work as table variables can...
January 19, 2011 at 3:52 am
You appear to selecting not merging.
Try something like:
SET ANSI_NULLS, QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE dbo.GetTblGUID
@Address nvarchar(255)
,@GUID uniqueidentifier OUTPUT
AS
DECLARE @GUIDs TABLE
(
[GUID] uniqueidentifier NOT NULL
);
INSERT INTO Tbl
OUTPUT inserted.[GUID] INTO @GUIDs
SELECT NEWID(), @Address
WHERE NOT EXISTS
(
SELECT...
January 18, 2011 at 10:15 am
You may be best to do it all in one statement to avoid potential concurrency problems.
Something like:
;WITH DivRows
AS
(
SELECT RowNo, Division, UserName
...
January 13, 2011 at 3:10 am
Add computed columns:
ALTER TABLE dbo.PCList
ADD PCNamePreFix
AS
(
CAST
(
CASE PATINDEX('%[0-9]%', PCName)
WHEN 1 THEN ''
WHEN 2 THEN LEFT(PCName, 1)
WHEN 3 THEN LEFT(PCName, 2)
ELSE LEFT(PCName, 3)
END
AS varchar(3)
)
) --PERSISTED
, PCNameNumber
AS
(
CAST
(
CASE PATINDEX('%[0-9]%', PCName)
WHEN 0 THEN...
January 12, 2011 at 9:46 am
harinerella (1/4/2011)
Simple solution could be applying UPDLOCK at the time of selection, which will not allow other sessions to lock the same row.
You also have to apply a key range...
January 4, 2011 at 3:49 am
Try:
SELECT usernumber
FROM tblaccess
WHERE readernumber IN (1,2,3,4,5,6)
GROUP BY A.usernumber
HAVING
-- Max entry accessid (assuming accessid is an IDENTITY. If not use accessdatetime.
MAX(CASE WHEN readernumber IN (1,2,3) THEN A.accessid ELSE 0 END)
...
December 16, 2010 at 5:12 am
Assuming your DDL is something like:
CREATE TABLE tblaccess
(
accessid int IDENTITY NOT NULL
PRIMARY KEY
,accessdatetime datetime
,usernumber int NOT NULL
,readernumber int NOT NULL
)
CREATE TABLE readernumbers
(
readernumber int NOT NULL
PRIMARY KEY
,readerSet varchar(5)
CHECK (readerSet IN ('entry',...
December 15, 2010 at 10:01 am
If the table is heavily used, you might have problems in obtaining a schema lock to do the sp_rename.
You may have to look at doing an upsert and changing the...
December 14, 2010 at 4:48 am
Viewing 15 posts - 796 through 810 (of 1,494 total)