Viewing 15 posts - 1,816 through 1,830 (of 2,171 total)
UPDATE T2
SET T2.f3 = T1.f3,
T2.f4 = T1.f4
FROM T2
INNER JOIN (
SELECT f2,
MAX(f1) f1
FROM T1
GROUP BY f2
) q ON q.f2 = T2.f2
INNER JOIN T1...
August 28, 2006 at 4:13 am
What is an "Actual Table Type"?
August 28, 2006 at 4:05 am
Then put an INSERT statement just before my SELECT statement and the case should be closed.
August 26, 2006 at 6:35 am
Tadaa!!!!
SELECT z.part1 + '-' + CONVERT(VARCHAR, z.part2) refNo
FROM (
SELECT PARSENAME(REPLACE(refNo, '-', '.'), 2) part1,
MAX(CONVERT(INT, PARSENAME(REPLACE(refNo, '-', '.'), 1))) part2
FROM YourTable
GROUP BY PARSENAME(REPLACE(refNo, '-', '.'),...
August 25, 2006 at 2:10 am
declare @test-2 table (empid int, id int, no int, name varchar(100))
insert @test
select 1, 123, 111, 'George' union all
select 1, NULL, 111, 'George' union all
select 2, 456, 222, 'George' union all
select 2, 475, 222, 'Raj' union...
August 25, 2006 at 1:43 am
GO is an execute command for T-SQL
after a GO, all variables are lost. Just as happens when you execute different queries in QA.
August 25, 2006 at 1:35 am
If you don't have SQL 2005, this might do the trick.
-- prepare test data
declare @Table1 table (ID int, Number int, DT varchar(10), [Name] varchar(10))
insert into...
August 25, 2006 at 1:08 am
Also try to put as many comparisons at the JOIN level instead of WHERE level.
As Gift Peddie writes, that produces smaller resultsets to be joined, and the query will be...
August 25, 2006 at 12:41 am
IF NOT EXISTS (SELECT * FROM MyTable WHERE AcctNo = 'aaa' and code = 'x')
INSERT INTO MyTable
(AcctNo, Code)
SELECT
'aaa', 'y'
IF NOT EXISTS (SELECT * FROM MyTable WHERE AcctNo = 'bbb' and...
August 25, 2006 at 12:39 am
Of course you have to replace my table vwExchange with the name of the table on your system you want to investigate...
August 24, 2006 at 10:57 pm
I don't understand what you mean.
August 24, 2006 at 4:53 am
The case is
UPDATE SomeTable SET SomeCol = Whatever WHERE 1 = 0
That makes the trigger execute, updating any record that does not exist.
It is good to check the INSERTED table...
August 24, 2006 at 4:52 am
Why would division by zero be better than a division by NULL?
August 24, 2006 at 1:57 am
Viewing 15 posts - 1,816 through 1,830 (of 2,171 total)