Viewing 15 posts - 8,536 through 8,550 (of 8,730 total)
What worked? Lucas option doesn't seem like a great option.
You could use something like this for the HAVING
SELECT product, region, status
FROM products prd
INNER JOIN pd_status S on s.product_status_key=prd.status_key
WHERE...
August 28, 2012 at 8:00 am
There's no T-SQL syntax, but there are tricks in SSMS.
You can right click on the the table in the object explorer and choose: Script Table as -> SELECT To ->...
August 28, 2012 at 7:47 am
I'm sorry I didn't replied yesterday but we had to leave the office because of Isaac.
Here's a query that will work as a static report. It can be easily transformed...
August 28, 2012 at 6:53 am
I'm sorry Matt, but your query looks complicated and more expensive than a simple Cross Tab that would require only 2 tables and an inner join.
I have the query but...
August 27, 2012 at 1:14 pm
A simple modification to the code to avoid problems with missing quarters (shouldn't happen but it could), I also believe is easier to understand.
DECLARE @test-2 TABLE( Year int,Qrtr...
August 27, 2012 at 12:45 pm
I guess it was wrong for me to read the 2012 version as it is less explicit.
But I still believe the OP won't have an option on creating the indexed...
August 27, 2012 at 9:04 am
The first rule would be getting rid of that horrible while loop and use the dates intervals.
DECLARE @Date1datetime,
@Date2 datetime
SET @Date1 = DATEADD( mm, DATEDIFF(mm, 0, Getdate()), 0)
SET @Date2 = DATEADD(...
August 27, 2012 at 8:45 am
jdbrown239 (8/26/2012)
Need to create view with no outer joins so I can index the view.
I can't find a restriction for indexed views that involves outer joins http://msdn.microsoft.com/en-us/library/ms191432.aspx. Are you...
August 27, 2012 at 8:30 am
You were joining your grouped results with the original table with duplicates. You can get an even simpler version of your code like this, no need of a subquery:
SELECT @MSGOUT...
August 27, 2012 at 7:55 am
I'm leaving the office now, but here's another option:
DECLARE @Total float,
@Total2 float
SELECT @Total = COUNT( *),
@Total2 = COUNT( CASE WHEN regstate = 'CA' THEN regstate END )
FROM #Cars
SELECT c.CarModel,
(COUNT( CASE...
August 24, 2012 at 3:12 pm
Don't trust me, but using Lynn's code to test performance with more leading zeros (100 more) the results are consistent.
All the methods took longer to run and the double REPLACE...
August 24, 2012 at 2:30 pm
I might be wrong, but you could have a column called PhoneEntity so you can know which table uses that phone.
Your "single table model" suggests a phone can be owned...
August 24, 2012 at 2:20 pm
What happens when a location/person has more than one phone?
It's really common.
August 24, 2012 at 12:46 pm
You can't do that directly.
You could do it with dynamic code, but you need to be careful of SQL injection.
The best way to achieve it is to redesign you database...
August 24, 2012 at 11:54 am
tyson.price (8/24/2012)
Most programmers would need to research what "'%[^'+@Char+'X]%'" means if they came across it supporting code. Why put that in place when something much more readable can be...
August 24, 2012 at 11:28 am
Viewing 15 posts - 8,536 through 8,550 (of 8,730 total)