Viewing 15 posts - 4,801 through 4,815 (of 10,144 total)
Hi Paul
Can you set up your sample data as ddl and dml please? There are instructions for this in the first article in my sig. Cheers.
April 16, 2013 at 3:07 am
Pankaj067 (4/16/2013)
You can implement RANK in your query like this
select *,
RANK() over (partition by name order by row)...
April 16, 2013 at 2:02 am
Have a look at the query shown in the first post of this thread. There are no aliases on the output columns so we can't tell which columns come from...
April 16, 2013 at 1:44 am
JayK (4/14/2013)
April 16, 2013 at 1:36 am
Rob-350472 (4/15/2013)
I've created a temp table which has a bunch of IDs and dates, something dead simple like this:
SELECT
Pg.ID,
pg.Name,
COUNT(pa.Log_ID) as A,
FROM tbla pg
JOIN #log pa on pa.ID = pg.ID
GROUP BY...
April 16, 2013 at 1:27 am
SELECT
TableSource = CASE WHEN T1.[Name] IS NULL THEN 'Table2' ELSE 'Table1' END,
T1.[Name],
T1.[Address],
T2.[Name],
T2.[Address]
FROM [dbo].[My Table 1] T1
FULL OUTER JOIN [dbo].[My Table 2] T2
ON T1.[Name] = T2.[Name]
WHERE...
April 16, 2013 at 1:18 am
SELECT d.*
FROM (VALUES ('ooo'),('bbb'),('ccc'),('ddd'),('eee'),('fff'),('ggg'),('hhh'),('iii'),('jjj'),('kkk'),('lll')) d (name)
WHERE NOT EXISTS (SELECT 1 FROM List l WHERE l.name = d.name)
April 16, 2013 at 1:10 am
Many folks stick to this syntax:
UPDATE pv -- alias of first table listed in FROM clause
SET
PV_ChangeDate = GETDATE(),
PV_ChangeUser = 'Peter',
PV_IntValue = 1000
FROM ParamValues pv -- put the UPDATE target...
April 15, 2013 at 8:32 am
vgargav (4/15/2013)
April 15, 2013 at 8:25 am
;WITH Credits AS (
SELECT crparty, cramount = SUM(crAmount)
FROM voucherCr
GROUP BY crparty
), Debits AS (
SELECT drparty, drAmount = SUM(drAmount)
FROM voucherDr
GROUP BY drparty
)
INSERT INTO ledgerBalance (party, closingBalance)
SELECT
Party = COALESCE(c.crparty,...
April 15, 2013 at 6:49 am
That looks ok to me, other than the joins to the temp table not being optimized. You don't really need the temp table anyway:
SET @RowsDeleted = 1000;
WHILE @RowsDeleted > 0
BEGIN
BEGIN...
April 15, 2013 at 6:26 am
Yep, this is a recursive CTE, and this is one of the few problems where it's use would be recommended. I'll fish around for a reference or two...
April 15, 2013 at 5:58 am
Last of all, can you post the actual batch please? Change the table name if you need to.
April 15, 2013 at 5:22 am
Can you run this please?
EXEC sp_spaceused 'mytable'
- change the table name to the name of the table you are deleting from.
Also, run this:
DBCC SQLPERF ( LOGSPACE )
April 15, 2013 at 4:55 am
sagar0838 (4/15/2013)
Can anyone provide link for :Visual Studio 2005 as i am unable to find it
April 15, 2013 at 4:33 am
Viewing 15 posts - 4,801 through 4,815 (of 10,144 total)