Viewing 15 posts - 6,346 through 6,360 (of 8,731 total)
Remember that CTEs will be available only for one statement and not the whole query/procedure.
Think of them as some kind of re-arranged subqueries.
June 4, 2014 at 11:36 am
This will generate the dynamic pivot for any number of years.
Read more about it in the following article: http://www.sqlservercentral.com/articles/Crosstab/65048/
DECLARE @Years nvarchar(4000) = '',
@Amt1 nvarchar(4000)...
June 4, 2014 at 10:31 am
And where are you using table2?
You didn't include the CTE definitions and there's a lot of missing information.
Please include the whole code to understand the problem.
June 4, 2014 at 9:59 am
sqldriver (6/4/2014)
I didn't see this code in the initial capitalization thread. It's what I've been using happily for a couple years. Not sure how it compares to the other solutions.
You...
June 4, 2014 at 9:28 am
Or maybe something like this:
CREATE TABLE Employee(
EMPID int,
FNAME varchar(100),
LNAME varchar(100))
CREATE TABLE Contact(
...
June 4, 2014 at 8:56 am
This is just a suggestion and keep in mind that I don't have many details, but I'd usually work with something like this:
CREATE TABLE Portfolio(
PortFolioID ...
June 4, 2014 at 8:32 am
This is an option. I'm not sure about it. I wonder if there's a better option with this structure. Would it be possible to make changes to the table?
DECLARE @PortfolioID...
June 3, 2014 at 3:23 pm
Sean Lange (6/3/2014)
Luis Cazares (6/3/2014)
Could...
June 3, 2014 at 3:14 pm
patrickmcginnis59 10839 (6/3/2014)
So whats the beef with "best practices"?
I'm sure the problem is with the:
objectively bad recommendations listed under a title "best practices"
June 3, 2014 at 2:41 pm
That's an uncommon hierarchy structure. Usually the children have the reference to the parent and not the other way around (that reduces rows from the table).
Could you give an example...
June 3, 2014 at 2:36 pm
patrickmcginnis59 10839 (6/3/2014)
Rudyx - the Doctor (6/3/2014)
- table variables need to be depracated with extreme prejudice
- SSMS generated code (IMAX screen...
June 3, 2014 at 12:11 pm
I noted the same thing when I was testing the code and mention it in my original post. I thought that the sample data might be wrong and posted the...
June 3, 2014 at 8:50 am
You're right. Private emails (or any form of communication) is better when dealing with this. People will react better than when you call them out in public and there are...
June 3, 2014 at 8:46 am
I'm surprised that Jeff didn't mention that recursive CTEs that count are a form of hidden RBAR (and he usually mentions it even with such few rows).
Here you have...
June 3, 2014 at 8:42 am
Viewing 15 posts - 6,346 through 6,360 (of 8,731 total)