Viewing 15 posts - 2,476 through 2,490 (of 3,957 total)
You can use a more efficient numbers table that returns numbers up to 1000:
;WITH Nbrs ( Number ) AS (
SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL))
...
November 18, 2012 at 7:28 pm
Here's another way to do it while avoiding the use of DISTINCT:
SELECT Province, District
,FPS=STUFF((
SELECT ',' + b.FP
...
November 18, 2012 at 5:55 pm
t.brown 89142 (11/16/2012)
I had assumed (incorrectly as it turns out) that this problem would have a standard SQL solution as its a classic two file problem read file A,...
November 18, 2012 at 5:34 pm
Here's an interesting bit of code you can try:
CREATE TABLE #Doctors
(ID INT IDENTITY, Name VARCHAR(100), Practice VARCHAR(100), [Views] INT)
CREATE TABLE #DoctorInfo
(Name VARCHAR(100),...
November 16, 2012 at 2:55 am
Michael Meierruth (11/16/2012)
November 16, 2012 at 12:56 am
Jeff Moden (11/15/2012)
dwain.c (11/15/2012)
Great explanations though!
I'm going to try to see if I...
November 16, 2012 at 12:03 am
I think this is the "normal" catch all query form for this.
SELECT *
FROM #Companies
WHERE (@CompanyID IS NULL OR CompanyID = @CompanyID) AND
(@CompanyGroupID IS NULL...
November 15, 2012 at 10:42 pm
mickyT (11/15/2012)
;with companyNotNull as (
SELECT * FROM #Companies WHERE CompanyID = @CompanyID
),
companyNull as (
Select CompanyID FROM #CompanyGroups WHERE CompanyGroupID =...
November 15, 2012 at 10:22 pm
opc.three (11/15/2012)
November 15, 2012 at 10:16 pm
You might still be able to do it by JOINing the derived table a to whatever it is you need to get. It might not be as complex as...
November 15, 2012 at 10:14 pm
Note that with the suggested approach, you'll be limited to returning columns that exist in the Doctors table. If you need stuff out of those other JOINs you'll be...
November 15, 2012 at 9:31 pm
This is just a guess mind you but perhaps something like this would work:
SELECT DoctorID, LastName, FirstName
FROM (
UPDATE Doctors
SET NumImpressionsInSearches =...
November 15, 2012 at 9:23 pm
Of course there will be carriage returns at the end of each line of numbers.
Try this:
SELECT LEN(REPLACE(REPLACE(@SQL, CHAR(10), ''), CHAR(13), ''))
November 15, 2012 at 9:13 pm
Here's a method using the rCTE approach to calculating a running total:
CREATE TABLE #TblTest (
id int not null identity(1,1) primary key,
value int not null
);
INSERT INTO #TblTest (value) VALUES...
November 15, 2012 at 9:08 pm
Viewing 15 posts - 2,476 through 2,490 (of 3,957 total)