Viewing 15 posts - 5,611 through 5,625 (of 15,381 total)
pbaldy (2/26/2014)
February 26, 2014 at 12:37 pm
pbaldy (2/26/2014)
February 26, 2014 at 12:10 pm
Luis Cazares (2/26/2014)
Sean Lange (2/26/2014)
It is hard to figure out exactly what your code is doing but I think the loop would be fairly easy to get rid of too.
And...
February 26, 2014 at 8:27 am
I am pretty sure you could get rid of the dynamic sql at the very least. Isn't this this same thing for Check 1?
/* check 1 */
IF @Check1 is null
insert...
February 26, 2014 at 8:02 am
I have a feeling too that you could make this entire thing into a few insert statements with no dynamic sql and no looping. It is so hard to read.
February 26, 2014 at 7:51 am
You need to look up sql injection. Your code is pretty much a text book case of vulnerable to sql injection.
February 26, 2014 at 7:49 am
As you are discovering you can't put a delimited list inside a variable and use IN to find all the values. You have a couple of choices here.
1) You could...
February 26, 2014 at 7:42 am
Your final query would end up something like this.
create table #Something
(
Area varchar(50)
)
insert #Something
select 'north,south,west'
select split.Item as Area
from #Something s
cross apply dbo.DelimitedSplit8K(s.Area, ',') split
drop table #Something
February 26, 2014 at 7:34 am
compufreak (2/26/2014)
I have a problem, I am trying to split a row that currently has information like this:
area: north,south,west
however I want the area column to display the information like...
February 26, 2014 at 7:31 am
Joey Morgan (2/25/2014)
Drat. You're right.Oh well...
:ermm:
Your solution is a good one when all the data is aggregated though. 😛
February 25, 2014 at 2:46 pm
Joey Morgan (2/25/2014)
DECLARE @TestTable TABLE
(
id INT
,testValue NVARCHAR(10)
,someNumber INT
);
INSERT INTO @testTable
(id, testValue, someNumber)
VALUES
(1, 'First', 10);
INSERT INTO @testTable
(id, testValue, someNumber)
VALUES
(2, 'Second', 3);
INSERT INTO @testTable
(id, testValue,...
February 25, 2014 at 2:32 pm
Joey Morgan (2/25/2014)
halifaxdal (2/25/2014)
I have an existing query:
SELECT
i.Division,
DocStatus,
...
February 25, 2014 at 9:59 am
nadarajan_v (2/25/2014)
I have an orders tables. From this table I have to retrieve all order Ids which are in the pending status. For these orders then I have to update...
February 25, 2014 at 9:54 am
kwoznica (2/25/2014)
I think this will work. I just changed the sort order of Historical in the ranking function.
with NumberedSet as
(
SELECT ItemNo, Blocked, DoNotUse, Historical, rn = ROW_NUMBER() OVER...
February 25, 2014 at 8:00 am
You said the inner query returns the rows you want to update. That is basically the same thing I posted previously. Not sure what the point of the outer query...
February 25, 2014 at 7:56 am
Viewing 15 posts - 5,611 through 5,625 (of 15,381 total)