Viewing 15 posts - 466 through 480 (of 1,347 total)
Try using SET SHOWPLAN_TEXT ON - it will make the output less verbose an easier to interpret.
One immediate observation is:
Clustered Index Scan
Ideally you'd like to see an index seek. Are...
June 1, 2006 at 9:46 am
What is the query execution plan ? (Paste the SQL into Query Analyser and hit CTRL-L)
Are any of the columns being updated foreign keys to other tables ?
Are there any triggers...
June 1, 2006 at 9:19 am
Aren't you missing a backward slash ?
set @cmd = '"D:\7ZIP\7z.exe"
Also, what user is this running under when you execute from query analyser ? Perhaps you don't have the user...
May 31, 2006 at 9:58 am
The '+' operator performs string concatenation.
The CROSS JOIN join operator gives you the required resultset.
SELECT t1.PhysicalName + t2.PhysicalName
FROM YourConfigTable As t1
CROSS JOIN YourConfigTable As t2
WHERE t1.LogicalName = 'Working Directory'
AND t2.LogicalName =...
May 29, 2006 at 1:21 pm
If you have no control over the comma-separated list coming from the front-end, then you best bet is to transform it into an XML document (easier than it sounds) and...
May 26, 2006 at 3:06 pm
Option B (inner Joins) will kick the pants of option A performance wise. Option A should be avoided at all costs - you might as well use a cursor because...
May 26, 2006 at 10:15 am
DISTINCT syntax does not use parentheses. This should work:
SELECT DISTINCT col1,col2,col3
INTO DeDupedTable
FROM tableA
May 26, 2006 at 10:03 am
Put the results into 1 of 3 temporary table. Once complete, dump the tables to the filesystem using BCP or DTS.
Are you sure you need cursors ?
May 26, 2006 at 9:39 am
See this recent, similar thread:
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=282795
Distinct works across all the columns in the result set. If you want unique col1 values, but also want col2 & col3 in your resultset,...
May 26, 2006 at 9:33 am
>>To do this you could run something like
>>Select ssn, Min(LastName) as LastName, Min(FirstName) as First Name, Min(DOB) as DOB
I've seen this done often to eliminate dupes and it is...
May 26, 2006 at 8:52 am
Sorry, didn't notice you'd already aliased the column as FullName:
-- Derived table to build full name for each id
INNER JOIN
(SELECT id, firstname + ' ' + lastname AS CreatorName
FROM ...
May 25, 2006 at 1:16 pm
MIN() and MAX() aggregates work with varchar, so the concept is no different.
May 25, 2006 at 12:41 pm
IF is for control flow, it is not valid syntax to use it within a SELECT statement.
Use CASE ... WHEN instead:
CASE
WHEN @ExtendedPrice != '0' THEN CONVERT(money, [GrossMargin]/[ExtendedPrice])
-- what happens...
May 25, 2006 at 10:59 am
Read about SQL aggregates and GROUP BY:
SELECT da_id, MIN(acct_num) As LowestAcctNum
FROM #temp
GROUP BY da_id
May 25, 2006 at 10:39 am
>>though I am using DISTINCT for SSN still am getting repeated
You are missing the point. DISTINCT does not work on simply 1 column. It works across all columns in the...
May 25, 2006 at 9:54 am
Viewing 15 posts - 466 through 480 (of 1,347 total)