Viewing 15 posts - 421 through 435 (of 4,080 total)
Also, to save you the trouble of future attempts along similar lines, it is important to understand that SQL queries reference specific objects and create execution plans based on the...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 2, 2016 at 11:58 am
I'd use CASE and STUFF to replace a leading '-' when one exists.
declare @input table (ID int identity(1,1) primary key, Country varchar(20));
insert into @input
values ('-UK'),('-US'),('SW'), ('DE'),('FR-CA')
select ID, CASE WHEN...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
August 2, 2016 at 11:40 am
You can pass multiple CEPs to your procedure using a table-valued parameter. If your lookup to Google doesn't accept multiple values, you will have to use a...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 27, 2016 at 9:26 am
Odd problem. Was this a test or interview question?
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 25, 2016 at 9:12 am
Here is the format for nearest neighbor code in MSDN.
https://msdn.microsoft.com/en-us/library/ff929109.aspx
I agree with Eirikur, get rid of your hints.
On a small scale, say within a city, you...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 25, 2016 at 8:25 am
Second thought: Do your tables have indexes on ODGUID,ProvGuid, and UserGuid (where those are the first columns in the index) ?
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 22, 2016 at 8:51 am
FROM [SAC].[dbo].[SO] observ
INNER JOIN [SS].[dbo].[WCD] cd on cd.ODGUID= observ.ODGUID
AND Observ.EDtm >= 'Aug 6 2013 3:55PM' AND Observ.EDtm <= 'Aug 1 2016 12:00AM'
INNER JOIN [SAC].[dbo].[SPDim] prov ON prov.ProvGUID = cd.UserGUID
AND...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 22, 2016 at 8:29 am
A good indicator of parameter sniffing can be found from looking at the actual execution plan. If estimated numbers of rows differ wildly from the actual number...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 22, 2016 at 8:20 am
Here is a two-pass approach to get you the values you want. The first pass gets the maximum date within ID for which each column has a (non-null)...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 21, 2016 at 3:04 pm
I agree with Jeff, that if you have company name (or a company number integer) as part of the table, then you can just use one table and identify the...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 21, 2016 at 8:12 am
While I loathe to place a solution for what you are asking for the very reasons explained before my post.....Based on your small dataset and given the constraint of NOT...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 20, 2016 at 2:39 pm
This should work for you, but your table design is incorrect. In the long term are much better off breaking the various component ID numbers down into...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 20, 2016 at 1:03 pm
Another example, that simply uses a CASE expression to test whether a 1 appears before a 2 in the string.
with ExampleData (AlphaNum) as (select...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 20, 2016 at 8:50 am
You can also look at the query plan and see how many threads are running from the outputs of parallel operations.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 12, 2016 at 9:24 am
As I recall, 2005 doesn't support windowed functions, so you have to deal with any running totals problem (decrementing from a total falls under the category of running totals) in...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
July 11, 2016 at 2:10 pm
Viewing 15 posts - 421 through 435 (of 4,080 total)