Viewing 15 posts - 1,201 through 1,215 (of 1,491 total)
This query JOINS tbl_Order to tbl_Agreement ON O.OrderNo = A.OrderNo AND O.Type < 3.
The FULL JOIN then adds the rows from tbl_Order and tbl_Agreement which were not included in the...
May 2, 2007 at 4:16 am
This thread may be of interest:
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=9&messageid=349243&p=1
May 1, 2007 at 10:23 am
This is a basic outline:
Locks in SQL are only held for the duration of a transaction. If you do not define your own transactions, each command is its own transaction....
May 1, 2007 at 5:53 am
In SP2, assuming the same filter condition for the SELECT and UPDATE of table1, is it possible that new rows can be added to table1 between the time of the...
April 26, 2007 at 10:25 am
or:
SELECT P1.MAIN_CODE
,P1.SUB_CODE
,P1.[NAME]
,P2.INTVALUE AS Days
FROM pinf P1
LEFT JOIN pinf P2
ON P1.MAIN_CODE = P2.MAIN_CODE
AND P1.SUB_CODE = P2.SUB_CODE
AND P2.[NAME] = 'DAYS'
WHERE P1.MAIN_CODE = 'RET'
AND P1.[NAME] <> 'ENDS'
[Edit] Sorry Sean, you had already...
April 25, 2007 at 2:38 am
In SQL2000, you need to monitor @@ERROR after each statement. With your example, in testUnique do something like:
EXEC (@strSQLExec)
RETURN(@@ERROR)
and in launchtestUnique do something like:
DECLARE @Err int
EXEC @Err =...
April 24, 2007 at 4:09 am
Maybe:
DECLARE @TenantID int
SET @TenantID = 1 -- ID for Tenant
SELECT B.*
FROM Building B
JOIN (
SELECT BA1.BuildingID, COUNT(*) AS MatchingAttributes
FROM Requirements R1
JOIN BuildingAttribute BA1
ON R1.AttributeID = BA1.AttributeID
AND R1.TenantID = @TenantID
GROUP BY...
April 23, 2007 at 4:17 am
I would be interested in knowing how well something like the following works:
-- *** Test Data ***
CREATE TABLE #YourTable
(
StartTime datetime NOT NULL
,EndTime datetime NULL
)
GO
INSERT INTO #YourTable
SELECT '20070419 08:32', NULL UNION...
April 20, 2007 at 5:13 am
SELECT *
FROM RSAccouts A
WHERE A.Level1Account = (
SELECT A1.Level1Account
FROM RSAccouts A1
WHERE A1.AccountCode = '000009'
)
April 19, 2007 at 3:05 am
Obviously you will have to join to Table1 outside of the derived table as well. Something like:
SELECT T1.*, T2.*
FROM Table1 T1
JOIN Table2 T2
ON T1.col1 = T2.col1
JOIN (
SELECT T4.col1, MAX(T4.colDate) AS...
April 19, 2007 at 1:57 am
Derived tables can be regarded as inline views so you cannot pass parameters. Something like the following should work:
SELECT T.col1, T.colDate, T.col3
FROM Table2 T
JOIN (
SELECT T2.col1, MAX(T2.colDate) AS maxDate
FROM Table1...
April 18, 2007 at 8:02 am
The quick method of doing this from the command prompt is:
echo.>>YourFile.csv
You could put this in a batch file.
April 17, 2007 at 8:03 am
Maybe:
SELECT MIN(ProductCode)
FROM YourTable
WHERE ProductCode >= '12'
April 17, 2007 at 7:32 am
If you need dynamic SQL, you can insert the results into a temp table. eg:
CREATE TABLE #Multi
(
Attribute varchar(100) NOT NULL
)
INSERT INTO #Multi
EXEC ('SELECT attribute FROM dbo.Staging WHERE CHARINDEX('','', attribute) >...
April 13, 2007 at 11:03 am
A table variable cannot be used as a parameter. (Also, it seems to be defined as @tMulti not @Multi.)
I see no point with dynamic SQL here. Why not just:
DECLARE @Multi...
April 13, 2007 at 10:37 am
Viewing 15 posts - 1,201 through 1,215 (of 1,491 total)