Viewing 15 posts - 751 through 765 (of 1,496 total)
1. sp_getapplock applies a user defined application lock. It saves an applicaiton having to cope with locking tables.
2. As sp_getapplock is waiting indefinately, SET LOCK_TIMEOUT must be set to -1...
April 13, 2011 at 9:36 am
It is far from clear what you want.
I suspect you may need to use UNION ALL instead of JOIN.
Maybe something like:
;WITH Combined
AS
(
SELECT nRunId, nTotal, nWaste, -1 AS nProductRunId
FROM LiveRun
UNION ALL
SELECT...
April 12, 2011 at 3:53 am
DELETE can only delete rows from one table so you will need to delete from each table in the correct order.
Something like the following:
DELETE docBodyVersion
WHERE EXISTS
(
SELECT *
FROM document D
WHERE D.docID...
April 7, 2011 at 9:59 am
Stuart Davies (3/17/2011)
March 17, 2011 at 9:59 am
It must be the date format. Is you server set to US English and your machine to British English?
Try the following:
SET DATEFORMAT dmy
SELECT ISDATE('27/1/2011')
SET DATEFORMAT mdy
SELECT ISDATE('27/1/2011')
SET DATEFORMAT ymd
SELECT ISDATE('27/1/2011')
Edit:...
March 17, 2011 at 8:58 am
Re-indexing is a bulk logged operation.
If you will never need to restore to a point in time while re-indexing is happening try:
1. Switch to bulk logged.
2. Reindex
3. Switch to Full.
The...
March 14, 2011 at 10:19 am
You could try disabling remote connections first.
March 14, 2011 at 8:01 am
SET ANSI_NULLS, QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE dbo.Insert_Login_Role
@Login_Name nvarchar(50),
@First_Name nvarchar(50),
@Last_name nvarchar(50),
@user_Password nvarchar(50),
--@Login_date date,
@Gender nchar(10),
--@Birth_year date,
@Role_Name nvarchar(50)
-- @Role_ID int
--@Role_ID2 int
AS
SET NOCOUNT ON
INSERT INTO [Login] (Login_Name, First_Name, Last_name, user_Password, Login_date, Gender, Birth_year)
OUTPUT @Role_Name, inserted.Role_ID...
March 11, 2011 at 9:09 am
A NOT EXISTS sub-query will also do as you want:
;WITH CheckTable (Cid)
AS
(
SELECT @param1
UNION ALL SELECT @param2
UNION ALL SELECT @param3
UNION ALL SELECT @param3
)
UPDATE [Table]
SET deleted = 1
WHERE id = @id
AND seq...
March 9, 2011 at 8:50 am
BeginnerBug (3/9/2011)
create table #sample(sno int identity,student_no int, head int,task varchar(50))insert into #sample (student_no,head,task) values(1,10,'tactical')
insert into #sample (student_no,head,task) values(10,20,'basket')
insert into #sample (student_no,head,task) values(20,40,'aerospace')
insert into #sample (student_no,head,task) values(40,10,'robot')
insert into #sample (student_no,head,task) values(10,40,'tackle')
insert...
March 9, 2011 at 6:38 am
An index on Col1, Col2, Col3, Col4, Col5, Col6, Col7 would help.
The following syntax may be more efficient:
;WITH MaxCol
AS
(
SELECT Col1, Col2, Col3, Col4, Col5, Col6, Col7, Col8
,MAX(Col7) OVER (PARTITION BY...
March 8, 2011 at 9:21 am
If possible, redesign the schema.
With your current schema, you can UNION ALL queries with SourceType = 1 and SourceType = 2.
March 7, 2011 at 6:06 am
The problem is more complicated if you have multiple levels of foreign keys.
Also the foreign keys may not have the same column names as the referenced column.
The following uses recursion...
March 4, 2011 at 10:17 am
To confirm what has already been said, a relation (table view etc) is an unordered set.
If you are importing data from a text file, and the original order is important,...
February 28, 2011 at 6:56 am
Viewing 15 posts - 751 through 765 (of 1,496 total)