Viewing 15 posts - 31 through 45 (of 445 total)
Kiril,
at least your script can run a good deal faster, if you'll choose to go this way. You needn't copy the whole source table into #TBL and needn't so...
December 11, 2015 at 1:00 am
Well..., in short it is not the way how SQL code should be created. Really. This code is slow and dangerous.
First, you shouldn't do this row by row thing. It's...
December 10, 2015 at 3:33 am
TheSQLGuru (12/9/2015)
One quick-and-easy way is to get min and max ID values and create a...
December 9, 2015 at 6:43 am
Or may be quite opposite
declare @tbl table(dt datetime, completeName varchar(100))
INSERT INTO @tbl values('20151130', 'Me'), ('20151110', 'other people'), ('20151201', 'candidat 1'), ('20151201', 'candidat 2')
SELECT * FROM @tbl order by dt ;
select...
December 9, 2015 at 5:49 am
Pivot is just a convenience method to say
select id,title,
ParentIdLevel1 = max(case ParentLevel when 1 then ParentId end),
ParentTitleLevel1 = max(case ParentLevel when 1 then ParentTitle end),
ParentIdLevel2 = max(case ParentLevel when...
December 9, 2015 at 4:51 am
Most probably there were a lot of DELETEs an INSERTs on a table with 1million+ rows. So IDs hardly are evenly distributed on (1 .. count(*)) interval or even on...
December 9, 2015 at 4:27 am
See my next post, don't know how to delete this error posting.
December 9, 2015 at 4:25 am
In short, no you can't. You really need some fancy things like those you mentioned above to tie new short id back to original GUID.
December 9, 2015 at 2:43 am
I recall OP was saying some rows do have not null IndexStartDate.
December 9, 2015 at 2:34 am
Provided explicitly defined intervals do not overlap try this to infer unknown start dates
declare @AsAtDate Datetime = '2015-06-01';
with cte as (
select *,
strt = isnull([IndexStartDate],lag([IndexEndDate],1,cast('19710101' as date))
over(partition by [PatientID] order...
December 8, 2015 at 4:26 am
Original table looks like bill of material type which is generally not restricted to tree structure, it may be a network hierarchy as well.
I added 'bike20' to demonstrate it.
I'd suggest...
December 8, 2015 at 3:31 am
Luis Cazares (12/7/2015)
December 8, 2015 at 2:25 am
You've said letter.
What about strings like Select @name = 'test2' or Select @name = ' test' , what result is expected?
December 8, 2015 at 12:29 am
More general way to do things like that
select GoodId
from T1
group by GoodId
having count(distinct case when LocNum in (501,502) then LocNum end) = 2
--having count(distinct case when LocNum in...
December 7, 2015 at 4:18 am
Looks like Sql CLR is your last resource. Create CLR proc3 which will call proc1, consume result sets and insert them into temp tables. In proc2 create temp tables and...
December 7, 2015 at 12:35 am
Viewing 15 posts - 31 through 45 (of 445 total)