Viewing 15 posts - 61 through 75 (of 284 total)
This works for your sample data. It may not work for your real data. It all depends upon if you can make the row that you don't want be the...
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
June 17, 2016 at 1:57 pm
I came up with the same query and then I re-read the OP and it seemed he did not want anything 'hard coded'. So I came up with this.
Select M.member_name,...
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
June 14, 2016 at 1:47 pm
sql_2005_fan (6/10/2016)
The Parallel Data Warehouse (PDW) features are not enabled.
How can I rewrite...
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
June 10, 2016 at 4:05 am
Your stated requirements do not match up with your expected output. This is the output of a query showing the previous endDate in the row with the startDate that it...
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
June 9, 2016 at 10:57 pm
Misread the problem.
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
April 26, 2016 at 10:10 pm
ajwilliams504 (4/19/2016)
Am I to assume the "123" is where I insert the
MAX(in_view.temp)FROM (SELECT temp = COUNT(state)
FROM stores
GROUP BY state) AS in_view
Of course!
I don't have any of your tables...
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
April 20, 2016 at 8:42 am
This little test function works for me.
CREATE FUNCTION test()
RETURNS int
AS
BEGIN
DECLARE @Result int
SELECT @Result = 123
RETURN @Result
END;
select dbo.test()
I noticed that you are not assigning anything to...
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
April 19, 2016 at 10:06 pm
Phil Parkin (4/4/2016)
'Tiddled' is what I was last Friday night. You meant 'tilde', I think 🙂
😀
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
April 5, 2016 at 10:51 am
Or change the delimiter to something that should not ever be in the source data like a pipe | or tidle ~.
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
April 4, 2016 at 3:12 pm
You are using an old and deprecated join method. You need to learn to use inner and left joins (among others) and aliases. It will make your code easier to...
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 25, 2016 at 12:34 am
Luis Cazares (3/14/2016)
I did mention it. The OP didn't like it.
You are right! I blew past it on the first page.
I'm not sure I understand his objection. If he can...
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 14, 2016 at 10:54 am
macdca (3/14/2016)
I only need the date part, and want to use a data parameter where I specify only one...
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 14, 2016 at 10:29 am
This little snippet produces your desired output.
;with cte as
(
Select code, effective, termination,
row_number() over (partition by code order by...
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 4, 2016 at 8:12 pm
giszzmo (2/19/2016)
I am updating Column2 with the year only from Column1. Since they both have DATE as data types
As you said yourself, Column2 is a DATE. Therefore, whatever you...
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 19, 2016 at 5:50 pm
Check out the QuoteName function in BOL.
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 11, 2016 at 9:12 am
Viewing 15 posts - 61 through 75 (of 284 total)