Viewing 15 posts - 16 through 30 (of 507 total)
When retrieving totals for the current year and prior year I almost always use a calendar table to do the heavy lifting. There is an example of this type...
January 12, 2012 at 12:13 pm
SQL Kiwi (1/10/2012)In fairness, you can do the same thing with a bit of UNION ALL action, but I like it.
SQL Kiwi (1/10/2012)
In fairness, you can do the same thing with a bit of UNION ALL action, but I like it.
Yeah, I like it too. Just bloody elegant it...
January 11, 2012 at 11:55 am
I would never have considered using actual columns from a table in a VALUES clause. Great little nugget there! I guess I need to think more outside the...
January 10, 2012 at 5:55 pm
First of all, you should never use a VARCHAR column for dates - especially if you want to sort them. I've changed your create table statement to:
create table #t...
January 10, 2012 at 4:58 pm
MS Dynamics/CRM 4 is pretty much the same.
I'll keep that in mind before taking any contracts dealing with it.
January 9, 2012 at 4:27 pm
Just to add another 2 cents. Readability can be very important. Try going back to some code you wrote a year ago. Keeping in standards in syntax...
January 9, 2012 at 1:06 pm
Take a gander as ASPDotNet Store Front if you want a horror story for table layouts. All pretty much NVARCHAR(MAX) or NTEXT.
January 9, 2012 at 12:28 pm
As Gail pointed out the reason for the deadlock is a read followed by an update - 2 queries.
There's another option, not quite as elegant as Gail's that will set...
January 5, 2012 at 1:10 pm
I would be very interested to see the code for the getForeignKey function. I've never researched or tried to use OPENROWSET in a function. My mind doesn't go...
January 5, 2012 at 12:28 pm
Dynamic SQL works fine when the passed WHERE type parameter is for something you can't determine ahead of time. If the passed parameter is always for the same column...
January 5, 2012 at 10:55 am
SET ROWCOUNT has been deprecated. You should use TOP instead to get a single row. It also won't cause any problems with other procedures.
January 4, 2012 at 12:38 pm
It looks like what you are trying to do falls into the category of Catch All queries. Here's an excellent article by Gail Shaw on the subject:
January 2, 2012 at 12:00 pm
About the only way I've ever been able to import this type of Header/Detail/Trailer type of data is to first import it into a staging table just a long text...
December 29, 2011 at 6:52 pm
Glad to help.
December 29, 2011 at 5:16 pm
Did this handle the problem for you?
December 29, 2011 at 12:51 pm