Viewing 15 posts - 181 through 195 (of 283 total)
Since you posted in an SQL 2012 forum, you could look at LAG & LEAD.
A non 2012 solution to this would be something like this:
;with cte as
(
Select...
July 28, 2014 at 4:14 pm
Luis Cazares (7/28/2014)
WHEN NOT MATCHED BY Source AND Target.EntryNumber =...
July 28, 2014 at 3:56 pm
The only difference is that the CTEs are building a dynamic table that the query runs against. It is a very quick way to generate a lot a rows to...
July 25, 2014 at 12:06 am
Sachin Nandanwar (7/6/2014)
Out of curiosity wondering how does this perform ?
I tried your solution with the posted test data and it does not return the required result set. So, I...
July 7, 2014 at 9:31 am
Thank you Sean & Kingston! Both solutions worked well. But Kingston's was just a touch faster.
Returning 88 rows from 46K, Sean's fastest time was .374 and Kingston's was .336....
July 4, 2014 at 5:44 pm
jaimepc199 (6/19/2014)
I forget something, is there any way to use windows functions on this example?thanks 😀
I am sure there is, but why complicate things when it is not necessary?
select codcategory...
June 19, 2014 at 4:51 pm
You actually have 2 things to worry about, the connection and the scope.
@@IDENTITY
Returns the last IDENTITY from a connection, regardless of the table and regardless of the scope. If you...
June 12, 2014 at 12:16 am
Awesome setup.
Give this code a try:
;with cte as
(
select MemberID, MoveDate, StreetAddress, suite, CityName, StateName, PostalCode,
ROW_NUMBER()...
April 2, 2014 at 12:18 pm
Given the following ddl:
declare @t table
(
id int
,fromDate varchar(10)
,endDate varchar(10)
)
insert @t (id, fromDate, endDate)
values
(1, '2014-03-20','2014-03-25')
,(2, '2014-03-15','')
,(3, '2014-02-24','2014-02-27')
,(4, '2014-03-10',NULL)
,(5, '2014-02-13',' ...
March 27, 2014 at 9:26 pm
There's a Begin Tran and Rollback in the code somewhere.
Without explicitly trying the code, no ddl to work with, it looks like it should work.
March 19, 2014 at 3:35 pm
Normally you should not care about trailing 0's. The front end worries about the display and making it pretty.
But if you have to, this should do it:
Select cast(100/2.0 as decimal(3))
March 16, 2014 at 9:32 pm
I'm sure that there is a real cool recursive cte that would traverse this tree. But given your data structure and your required output, I was able to get the...
February 22, 2014 at 3:56 pm
Tom, Milos
Thanks for the solution. They both worked as advertised. This solution removed a large loop that was updating and inserting rows into a table. For about a 1000 rows...
February 17, 2014 at 10:06 am
Thanks for the reply. But, this does not solve my issues.
The reason the string has to be 'ABC' is because that is the row that is being pointed at by...
February 16, 2014 at 11:26 am
Viewing 15 posts - 181 through 195 (of 283 total)