Viewing 15 posts - 241 through 255 (of 267 total)
Hi,
The following is pretty efficient...
FYI there are 52178 mondays in this millenium ( <3 sec to calculate ).
declare @yr int, @mth int
select @yr = 2004, @mth = 5
declare @startday datetime, @endday...
May 6, 2004 at 2:50 am
You could elaborate on the following ( 3 examples ):
select @@servername as server, count(distinct usr) as users, count(*) as processes from
( select sp.loginame as usr, sd.name as db
from sysprocesses sp join...
May 4, 2004 at 2:44 am
EM uses xp_msver to rerieve some server metadata.
See if xp_msver and @@version returns different results in QA ?
/rockmoose
May 4, 2004 at 2:24 am
I think you would be helped by a code generation tool.
Either write some TSql ( or other ) code that will generate the desired Name - Value pairs for You....
April 29, 2004 at 2:05 am
Another way to do this with just sending in two parameters ( pagenbr, pagesize ).
Would be. ( example from Pubs )
SET NOCOUNT ON
DECLARE @pagenbr INT,
@pagesize INT,
@rows_skipped INT
SET @pagenbr = 2
SET...
April 28, 2004 at 3:03 am
Some MetaData from INFORMATION_SCHEMA.COLUMNS in case You don't want to select from systables..
/rockmoose
SELECT
ic.ORDINAL_POSITION,
ic.COLUMN_NAME,
ic.DATA_TYPE,
ic.CHARACTER_MAXIMUM_LENGTH,
ic.NUMERIC_PRECISION,
ic.NUMERIC_SCALE,
IS_IDENTITY = COLUMNPROPERTY ( OBJECT_ID( ic.TABLE_CATALOG + '.' + ic.TABLE_SCHEMA + '.' + ic.TABLE_NAME ) , ic.COLUMN_NAME ,...
April 23, 2004 at 8:55 am
To filter the user tables in your sql
SELECT TABLE_NAME, COLUMN_NAME,
DATA_TYPE, CHARACTER_MAXIMUM_LENGTH,
ORDINAL_POSITION
FROM INFORMATION_SCHEMA.columns
WHERE OBJECTPROPERTY( OBJECT_ID(TABLE_CATALOG + '..' + TABLE_NAME), 'IsMsShipped' ) = 0
ORDER BY TABLE_NAME, ORDINAL_POSITION
/rockmoose
April 20, 2004 at 4:07 am
This Link will get you started retrieving metadata from sql server:
http://www.dbazine.com/sharma4.shtml
/rockmoose
April 20, 2004 at 2:58 am
Or given a Date:
DECLARE @DATE DATETIME
SET @DATE = GETDATE()
SELECT CAST(
-- First day of next month
DATEADD(MONTH,DATEDIFF(MONTH,0,@DATE)+1,0)
-
-- First day of current month
DATEADD(MONTH,DATEDIFF(MONTH,0,@DATE),0)
AS INT )
/rockmoose
April 20, 2004 at 2:51 am
Really nice, made me laugh.
Once had a project involving Crystal Reports. And I told a user that the reports could be exported to excel. But it didn't work the user...
April 19, 2004 at 1:12 am
1. Gain basic SQL knowledge.
You may "copy" data from one table to another using the INSERT statement or perhaps use SELECT INTO.
2. In SQL Server you may also use DTS...
April 16, 2004 at 12:31 pm
Much of the performance and scaling issue is the number of Concurrent users on the system. ie how many will use the system at the same time ( 4...
April 16, 2004 at 12:06 pm
If it is XOR you are after, you could modify alzdba constriant to:
alter table t_muteNULL
add constraint chkMuteNULL check ((case when col2 is null then 1 else 0 end) ^...
April 15, 2004 at 4:29 am
No, You would have to do the work in 2 sql batches UPDATE - INSERT
Something like...
UPDATE employee SET
salary = et.salary,
bonus = et.bonus,
comm = et.comm
FROM
emp_temp et
WHERE
employee.empno...
March 24, 2004 at 4:30 am
Hi,
Maybe using suser_sname(), and formatting result:
select
name as sql_user,
suser_sname(sid) as login,
left( suser_sname(sid), charindex('\', suser_sname(sid))-1 ) as domain,
substring( suser_sname(sid), charindex('\', suser_sname(sid))+1, len(suser_sname(sid)) ) as domain_user,
sid
from
sysusers
where
isntuser...
March 23, 2004 at 9:21 am
Viewing 15 posts - 241 through 255 (of 267 total)