Viewing 15 posts - 226 through 240 (of 267 total)
For completeness we might add the EXISTS method.
SELECT sg.sysusergroup_id, sg.sysusergroup_name
FROM sysusergroup sg
WHERE NOT EXISTS(
SELECT * FROM sysuser_sysusergroup susg
WHERE susg.sysuser_id = '1' AND sg.sysusergroup_id = susg.sysusergroup_id 
Performancewise the...
May 19, 2004 at 1:36 pm
SELECT sg.sysusergroup_id, sg.sysusergroup_name
FROM sysusergroup sg
WHERE sg.sysusergroup_id NOT IN(
SELECT susg.sysusergroup_id
FROM sysuser_sysusergroup susg
WHERE sysuser_id = '1' )
Just as an alternative to the outer join technique.
/rockmoose
May 19, 2004 at 2:45 am
No You cannot.
An accumulated sum measure measure might provide some of the functionality you require. Also You could add a "quarter" level in your time dimension.
/rockmoose
May 19, 2004 at 2:18 am
All the t2.e = "john" records in t2 with a,b,c,d fields not equal to a,b,c,d fields in t1
/rockmoose
May 18, 2004 at 4:19 pm
Better if You only want to list the distinct values of col1, col2, col3, col4.
A join or exists clause is still necessary if You want to list all the rows...
May 18, 2004 at 7:56 am
Actually I thought Antares response made good sense as answer to your question
Probably you are trying to find duplicate records.
( Consider putting...
May 18, 2004 at 1:11 am
Use a Function:
select ID, dbo.fn_return_name_recordset(ID) as name
from nameTable
where nameTable.ID='1000'
/rockmoose
May 18, 2004 at 12:54 am
Alternative approach is to have an Identity column, just for generating the identity number.
Then have a computed column:
(substring('0000000000',1,(10 - len([identity_col]))) + ltrim([identity_col])).
The computed column would hold the "formatted" identity nymber.
You...
May 13, 2004 at 2:39 am
Ok,
-- First case, generate same objects with new owner
Use Steve Jones script + search and replace method. Just make sure that in QA -> Tools -> Options -> Script You...
May 12, 2004 at 1:39 pm
select sc.text
from sysobjects so join syscomments sc on so.id = sc.id
where so.name = 'vaProctime'
-- and type = 'V'
But imho it would probably be easier to generate the whole
"ALTER VIEW dbo.table
select...
May 12, 2004 at 2:58 am
Syntax Error, Not surprising 😉
One way:
select vcFname, x.cnt
from
( select fk_intprojectID, count(*) as cnt
from tbl_ProjectsResearchers PR
group by fk_intprojectID ) as x
join tbl_Projects on x.fk_intprojectID = pk_intProjectID
where x.cnt > 0
Also the x...
May 12, 2004 at 2:44 am
One way:
select
case
when datepart(hour,tran_date) between 9 and 9 then '9am-10am (Morning)'
when datepart(hour,tran_date) between 12 and 13 then '12-2pm (Lunch)'
when datepart(hour,tran_date) between 17 and 18 then '5pm-7pm (Dinner)'
else 'Not morning, lunch, dinner'...
May 12, 2004 at 1:36 am
If You only want to change the owner of the tables, take a look at:
sp_changeobjectowner
( Also read the Remarks in BOL for this proc, concerning permissions for the changed objects(tables...
May 12, 2004 at 1:23 am
Hi,
Since You are already using dynamic sql for this, generating explicit field names should be a no problem :-).
I would go for Razvans suggestion and use the nifty "field name...
May 11, 2004 at 12:39 pm
You could use a global temporary table. ##table.
declare @sql as varchar(500)
set @sql = 'Select * into ##tmpClient from ' + @dbSource + '.dbo.Clients...
May 11, 2004 at 2:05 am
Viewing 15 posts - 226 through 240 (of 267 total)