Viewing 15 posts - 5,191 through 5,205 (of 7,597 total)
jgale 70688 (4/13/2015)
Both solutions did work. However, the data I'm working with is slightly more complex than my simple example. My main data table is a...
April 13, 2015 at 4:33 pm
Grant Fritchey (4/13/2015)
SELECT a.City,
a.PostalCode
FROM Person.Address AS a
WHERE ...
April 13, 2015 at 4:32 pm
Eirikur Eiriksson (4/13/2015)
ScottPletcher (4/13/2015)
SELECT...
April 13, 2015 at 3:33 pm
Luis Cazares (4/13/2015)
ScottPletcher (4/13/2015)
Go ahead and add DISTINCT to each separate query on which it's applicable:
SELECT DISTINCT omlSalesOrderID
FROM m1_dc.dbo.SalesOrderLines
WHERE omlPartID='finalmile'
UNION
SELECT ompSalesOrderID
FROM m1_dc.dbo.SalesOrders
WHERE ompShippingMethodID='JBFM'
Why? :unsure:
It's...
April 13, 2015 at 2:58 pm
Here's an alternative approach, also using CROSS APPLY, that can take advantage of the (presumed) clustered index on prefix.PREFIX_VALUE; no guarantee, but it might perform better.
SELECT p_cross_apply.PREFIX_VALUE, SUM(d.DATA_VALUE) AS...
April 13, 2015 at 2:54 pm
Go ahead and add DISTINCT to each separate query on which it's applicable:
SELECT DISTINCT omlSalesOrderID
FROM m1_dc.dbo.SalesOrderLines
WHERE omlPartID='finalmile'
UNION
SELECT ompSalesOrderID
FROM m1_dc.dbo.SalesOrders
WHERE ompShippingMethodID='JBFM'
April 13, 2015 at 2:37 pm
In general, since you want to avoid grouping by varchar columns anywhere, as it's not very efficient, delay converting numeric codes until the outer-most query you can.
select DB_NAME(a.database_id) AS [Database...
April 13, 2015 at 2:25 pm
Off the top of my head, I would use a temp table here, something like below. I don't have time to finish all the median values in the SELECT,...
April 9, 2015 at 3:57 pm
Eric Prévost (4/9/2015)
jdbrown239 (4/9/2015)
When the job runs it fails with the error: 'Procedure IndexOptimize, Line 505...
April 9, 2015 at 11:56 am
If the string is within SSMS, you could try adding a backslash to the end of each line to continue the string. For example:
declare @varchar varchar(30)
set @varchar = 'abcdef'
print...
April 9, 2015 at 9:49 am
CELKO (4/8/2015)
I have a column which needs to be 9 digits long.
I gave you a simple LIKE predicate to assure this, as per your request. I thought ...
April 9, 2015 at 9:46 am
CROSS APPLY often works well in these types of lookups:
SELECT *
FROM @vehicle v
CROSS APPLY (
SELECT TOP (1) *
FROM @vehicleclass vc
...
April 9, 2015 at 9:44 am
I think those are also uniqueidentifier columns, so fragmentation is to be expected. Unless you retain lots of backup info in msdb, and I would not recommend that, then...
April 9, 2015 at 9:38 am
I think those are also uniqueidentifier columns, so fragmentation is to be expected. Unless you retain lots of backup info in msdb -- and I would not recommend that...
April 9, 2015 at 9:38 am
You need to review the choice of clustering key; the clustering key is critical to performance, so never be lazy enough to allow the clustering key to default to identity....
April 9, 2015 at 9:33 am
Viewing 15 posts - 5,191 through 5,205 (of 7,597 total)