Viewing 15 posts - 1,111 through 1,125 (of 2,458 total)
vecerda (12/11/2015)
December 11, 2015 at 8:33 am
Just worth noting, in SQL 2012+ there are two "IF" statements.
There's IF which is part of the flow control language and can't be used inside a DML query and...
December 10, 2015 at 11:12 am
Another way, using delimitedsplit8K and patreplace8k (both referenced in my signature) would be like so:
declare @testdata table(expression varchar(500))
insert into @testdata
SELECT expression FROM
(values('[w1+w2+w3/5]'),('[(w1+w2+w3)/5]'),('[(w4-w5*w6)/5]')) x(expression)
select expression, Item
from @testdata
CROSS APPLY...
December 10, 2015 at 10:57 am
NP. Glad that worked for you. 😀
December 9, 2015 at 2:57 pm
I'd like this to be done with a stored procedure that takes as its input parameter a comma delimited string such as 'straw,farm,lane' and for there to be an iteration...
December 9, 2015 at 1:56 pm
Another solution... This will be a smidgen slower but the code will be much cleaner. Using the Pattern-Based splitter referenced in my signature you could get the first series of...
December 9, 2015 at 10:40 am
Just a couple more approaches because parsing strings is fun.
If the string you are searching for is always going to be 7 characters long you could do this (note...
December 9, 2015 at 10:30 am
Easy. Note my solution and comments:
DECLARE @UCase bit;
DECLARE @project varchar(10);
-- When @UCase is 0
SELECT @project = 'abc', @UCase = 0;
-- Logic for your output
SELECT PROJECT = CASE @UCase WHEN 0...
December 8, 2015 at 2:03 pm
On a side note, and I don't know if "the sudden slow down" happened when after the scalar udfs were added, but Scalar UDFs kill parallelism. Often the whole query...
December 8, 2015 at 9:11 am
Less impressive but worth mentioning... There are some notable powershell, enhancements in 2012 that make managing your server a little easier (for those that use powershell).
December 8, 2015 at 9:00 am
I just wanted to add that, if you have any control of the schema (it sounds like you might not). Just changing the DDL might make a big difference. E.g....
December 7, 2015 at 5:04 pm
Sergiy (12/7/2015)
Alan.B (12/7/2015)
December 7, 2015 at 4:33 pm
I'm with what everyone has said so far. I would add, however, that, if you are doing aggregations, you might want to consider an indexed view with the aggregations indexed....
December 7, 2015 at 10:54 am
This is how you would remove them only at the end:
DECLARE @table TABLE (col1 varchar(100));
INSERT @table VALUES ('address1'),('address2'+char(10)+char(13)),('address3');
SELECT
CASE
WHEN col1 LIKE '%'+char(10)+char(13)
THEN...
December 7, 2015 at 10:45 am
Joe Celko has the stable marriage problem (which I believe you are looking for) in his book: SQL Puzzles and Answers 2nd edition.
December 7, 2015 at 10:38 am
Viewing 15 posts - 1,111 through 1,125 (of 2,458 total)