Viewing 15 posts - 1,321 through 1,335 (of 1,417 total)
Try something like:
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE dbo.s_Status_View
@Status VARCHAR(10)
AS
SET NOCOUNT ON
DECLARE @translate TABLE
(
Status VARCHAR(10) COLLATE DATABASE_DEFAULT NOT NULL PRIMARY KEY
,Order_Status INT NOT NULL
)
October 19, 2006 at 10:55 am
Thinking about it, the second example will neither rollback nor commit. This means that when the session finishes, the INSERTs to the first table should be rolled back unless they...
October 19, 2006 at 10:33 am
I am not sure why you want to do an INSERT followed by an UPDATE, but your second example is always going to fail.
To stop users changing your SPs you...
October 19, 2006 at 10:20 am
>> 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
Viewing 15 posts - 1,321 through 1,335 (of 1,417 total)