Viewing 15 posts - 1,111 through 1,125 (of 1,999 total)
The person who wrote the original code or the tester that allowed it to make it into production?
ahem.... the tester didn't put the defect there (the developer did)...
May 23, 2012 at 9:59 am
see my example
create table footable (name varchar(1000))
go
select 'aaaaa';
with x (id) as
(select 1 as id
union all
select ID+1 from X as id
where id<10000
)
insert into fooTable
select d.name from sysdatabases d cross...
May 23, 2012 at 9:54 am
any code before the "WITH x as" must be terminated with a ;
May 23, 2012 at 9:52 am
the multiple rows returned in your select statement are corrupting the @cmd value - in theory the value returned should be correct (although if you use any fields from sys.server_principals...
May 23, 2012 at 9:49 am
sqlbee19 (5/23/2012)
----------------------------
set nocount on
declare @role varchar(255),@dbname varchar(255)
declare @rowid int
declare @user nvarchar(255)
declare @cmd varchar(8000)
set @dbname = 'Mydatabasedashboardaaaaaaaaa1111'
set @role = 'db_owner'...
May 23, 2012 at 9:46 am
you need to use a ranking function to find the first instance of a value
see my example below
select x.* from
(
select id,name,ROW_NUMBER() over (partition by id order by name asc)...
May 23, 2012 at 9:37 am
Steve Jones - SSC Editor (5/23/2012)
Mr or Mrs or Miss or Ms 500
Too long, and to be honest, didn't think about it. Plus, could you get to 500...
May 23, 2012 at 9:30 am
lucky it's a test box
May 23, 2012 at 9:28 am
+1 howard beat me to it, but slightly different solution
May 23, 2012 at 9:27 am
derek.colley (5/23/2012)
As a sometime dev who is used to loops (go VBScript go!) and more 'traditional'...
May 23, 2012 at 9:25 am
in that same database there was a checkpoint that seemed to have hung - looks like that was the issue - the checkpoint was doing nothing and had been for...
May 23, 2012 at 8:11 am
computed and PERSISTED would be even better
May 23, 2012 at 8:04 am
To answer your question, absolutely not. And that's why this problem won't be fixed until it becomes a real problem. It's also very typical. It's the reason...
May 23, 2012 at 7:30 am
Of course, that's also why I generally don't allow XML in any of my databases. 😀
Amen to that - praise be to edgar F codd and Raymond F Boyce!!!!!
May 23, 2012 at 7:24 am
alter the CTE to be as follows
with x (mon,monid,monthord) as
(select DATENAME(month,1) as month,1 as monid,1 as monthord
UNION ALL
select DATENAME(month,X.monid+31) as month,X.monid+31 as monid,x.monthord+1 as monthord from x
where monid<=311
)
now you have...
May 23, 2012 at 7:20 am
Viewing 15 posts - 1,111 through 1,125 (of 1,999 total)