Viewing 15 posts - 1,396 through 1,410 (of 1,490 total)
>> Object_ID not indicative of order of creation
There seems to be nothing else to indicate the order of creation.
Something like my query will produce the results in the order...
October 19, 2006 at 9:16 am
@t is a TEST table.
1. Take the query:
-- The Query
SELECT TID
,COUNT(DISTINCT TYPE) AS LOGON_TYPE_RECORD
,COUNT(CASE WHEN TYPE = 'JPJ' THEN 1 END) AS JPJ_RECORD
,COUNT(CASE WHEN TYPE = 'JPN' THEN 1 END)...
October 19, 2006 at 7:14 am
Assuming objectID indicates order of creation:
SELECT O.objectID
,O.objectName
FROM tblObject O
LEFT JOIN (
SELECT DISTINCT R.dependent_objectID
FROM tblDependency R ) D
ON O.objectID = D.dependent_objectID
ORDER BY
CASE WHEN D.dependent_objectID IS NULL
THEN 0
ELSE 1 END
,O.objectID
October 19, 2006 at 5:47 am
In this type of query you need to ALIAS all tables and use the ALIAS with the columns. Also, in this instance, I can see no point in using a...
October 19, 2006 at 4:50 am
Interesting...
With SQL2000:
In Example A the batch actually fails to compile so the transaction does not even begin. This is what I would expect to happen.
In Example B the batch does...
October 19, 2006 at 3:53 am
Without knowing the details, it looks as though it will work.
I would be inclined just to have an UPDATE statement rather than call the DELETE and INSERT SPs.
If you want...
October 18, 2006 at 11:45 am
Similar to this thread:
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=145&messageid=315718
You will need to use CASE to make zero return NULL.
ps You may do better if the data is normalized.
October 18, 2006 at 11:31 am
Do you mean SELECT?
INSERT YourTable
SELECT Col1, Col2, ...
FROM YourView
October 18, 2006 at 10:20 am
If you REALLY have to:
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE dbo.MyProc
( @EmployeeName VARCHAR(50)
-- MONEY may be better for Sal, or at least DECIMAL(18,4)
,@Sal NUMERIC(18,2)
,@EmpID INT OUTPUT )
AS
SET NOCOUNT ON
--SET...
October 18, 2006 at 8:18 am
As you are not raising any special errors, why not keep it simple:
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE dbo.MyProc
( @EmployeeName VARCHAR(50)
-- MONEY may be better for Sal, or at...
October 18, 2006 at 8:03 am
Something like the following should be more efficient as the table will only be scanned once:
-- Test Data
DECLARE @t TABLE
(
TID INT NOT NULL PRIMARY KEY
,TDate1 DATETIME NULL
,TDate2 DATETIME NULL
,TDate3 DATETIME...
October 17, 2006 at 10:33 am
In SQL2000, I do not think defaults are allowed to refer to other columns in the table.
You may be able to get away with this in SQL2005.
October 17, 2006 at 8:39 am
-- Test Data
DECLARE @t TABLE
(
TID CHAR(5) COLLATE DATABASE_DEFAULT NOT NULL
,TYPE CHAR(3) COLLATE DATABASE_DEFAULT NOT NULL
)
INSERT @t
SELECT 'KL202', 'JPJ' UNION ALL
SELECT 'KL202', 'JPJ' UNION ALL
SELECT 'KL202', 'JPN' UNION ALL
SELECT 'KL202', 'JIM'...
October 17, 2006 at 3:28 am
Viewing 15 posts - 1,396 through 1,410 (of 1,490 total)