Viewing 15 posts - 1,141 through 1,155 (of 1,496 total)
On looking at this again, James has a good point about an unique constraint on AA_Anno and Val_NumSpedizione. If you want to add this constraint then try an instead of trigger...
August 29, 2007 at 11:07 am
>>>And if the trigger goes in error (for some reason...), the transaction is rollbacked??
Maybe.
You need to be careful with transactions. If SET XACT_ABORT is off, as it normally is, then the statement is...
August 29, 2007 at 9:43 am
This may be what is wanted:
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE TRIGGER TR_I_GSP_Spedizione
ON dbo.GSP_Spedizione
AFTER INSERT
AS
DECLARE @I TABLE
(
ID_Spedizione int NOT NULL
,AA_Anno smallint NOT NULL
,RowID int IDENTITY NOT NULL
)
INSERT INTO @I (ID_Spedizione, AA_Anno)
SELECT...
August 29, 2007 at 9:04 am
I have just looked at this again and have managed to get nearly the same result with one CTE.
The difference is Job4 starts with Job1 and not Job7.
-- *** Test...
August 22, 2007 at 11:35 am
I tend to agree with you and Ninja has already pointed out to Hans that the data model is bad.
My understanding, based on the limited information provided, is that some...
August 22, 2007 at 10:15 am
In SQL2005, the best I can come up with for the sequence idea is a #temp table and two recursions. (As below)
If anyone can do any better I would be...
August 22, 2007 at 7:23 am
You may want something like the following. If not you will need to post test data and expected results in order for the problem to be understood.
DECLARE @t TABLE
(
[Proc] varchar(10)...
August 21, 2007 at 10:58 am
ORDER BY
CASE @SortBy
WHEN 'S'
THEN
CASE
WHEN column1 IS NULL AND column2 IS NULL
THEN ''
WHEN column1 IS NULL
THEN SPACE(255) + CAST(column2 AS varchar(255))-- 255 or length column1
WHEN column2 IS NULL
THEN CAST(column1 AS varchar(255))
ELSE...
August 20, 2007 at 6:56 am
ORDER BY
CASE @SortBy
WHEN 'S'
THEN ISNULL(CAST(column1 AS VARCHAR(255)) + ',', '') + column2
ELSE ISNULL(CAST(column3 AS VARCHAR(255)) + ',', '') + column2
END
August 20, 2007 at 6:15 am
SELECT *
FROM InvoiceDetails D
JOIN InvoiceSubDetails S
ON D.[ID] = S.InvoiceDetailID
JOIN (
SELECT S1.InvoiceDetailID
,COUNT(*) AS SubCount
FROM InvoiceSubDetails S1
GROUP BY S1.InvoiceDetailID
) V
ON D.[ID] = V.InvoiceDetailID
ORDER BY V.SubCount
August 20, 2007 at 6:08 am
SELECT
CASE N.Number
WHEN 1 THEN 'ParAmt'
WHEN 2 THEN 'DenomQty'
WHEN 3 THEN 'CInsNbr'
WHEN 4 THEN 'HNbr'
END AS Col
,CASE N.Number
WHEN 1 THEN ParAmt -- cast to float if not already float
WHEN 2 THEN...
August 17, 2007 at 8:01 am
SELECT
CASE N.Number
WHEN 1 THEN 'ParAmt'
WHEN 2 THEN 'DenomQty'
WHEN 3 THEN 'CInsNbr'
WHEN 4 THEN 'HNbr'
END AS Col
,CASE N.Number
WHEN 1 THEN ParAmt -- cast to float if not already float
WHEN 2 THEN...
August 17, 2007 at 7:51 am
It strikes me that we may have been seduced by our inner low level programmer. Maybe all that is required is a 256 row lookup table which...
August 17, 2007 at 3:17 am
I think the following is standard ANSI so it may work:
UPDATE FFIITMAP
SET FFIHGTH = (
SELECT MAX(C.CFFIHGTH)
FROM cubiscan C
WHERE C.CFFIITMN = FFIITMAP.FFIITMN
GROUP BY C.CFFIITMN
)
WHERE EXISTS (
SELECT *
FROM cubiscan C1
WHERE C1.CFFIITMN = FFIITMAP.FFIITMN
)
August 16, 2007 at 11:06 am
He seems to want to reverse the bits in a tinyint and then show the number in Hex.
Maybe:
-- From http://www.cs.utk.edu/~vose/c-stuff/bithacks.html#ReverseByteWith64BitsDiv
DECLARE @big1 bigint
,@big2 bigint
SELECT @big1 = 8623620610
,@big2 = 1136090292240
-- result may...
August 16, 2007 at 8:49 am
Viewing 15 posts - 1,141 through 1,155 (of 1,496 total)