Viewing 15 posts - 61 through 75 (of 921 total)
Try this, then:
Insert into TMP3 (col1,col2)
select TOP 100 PERCENT Col1, Col2
from TMP2
order by Col1
--Jonathan
March 11, 2004 at 2:40 pm
Try this:
Insert into TMP3 (col1,col2)
select Col1, Col2
from TMP2
order by Col1 OPTION (MAXDOP 1)
What version (and service pack) of SQL Server are you using? There used to be problems like this...
--Jonathan
March 11, 2004 at 2:09 pm
You are correct that it should not happen. Any such operation should be set-based and not expose any internal "cursor" behavior like this. It's a well-known "feature" of SQL Server,...
--Jonathan
March 11, 2004 at 1:56 pm
You don't need a function to do this, just a simple self-join.
SELECT a.Col + b.Col
FROM Table a JOIN Table b ON a.Col < b.Col
--Jonathan
March 11, 2004 at 1:39 pm
You're right of course, Frank.
SQL, not just SQL Server's behavior, should not order anything meaningfully unless you use an ORDER BY clause. Any order without that clause is an artifact...
--Jonathan
March 11, 2004 at 1:17 pm
You can't just substitute a variable for an object identifier in a statement unless you use dynamic SQL. Dynamic SQL can be used to declare cursors but gets sticky because...
--Jonathan
March 11, 2004 at 9:55 am
Can you use that information along with the error message to find the problem?
--Jonathan
March 11, 2004 at 9:35 am
You could use the DATEPART(dw,date) or DATENAME(dw,date) function. For best readability, perhaps something like this:
UPDATE c SET Holiday = 1
FROM @Orig_Calendar c JOIN Holiday_Schedule_Dates h ON c.Orig_Start =
CASE...
--Jonathan
March 11, 2004 at 9:11 am
You will need to either use dynamic SQL or "SET ROWCOUNT @orig_free" instead of TOP. If you use SET ROWCOUNT, don't forget to set it back to 0 after the...
--Jonathan
March 11, 2004 at 8:45 am
If you mean colums across all user tables and views:
SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
--Jonathan
March 11, 2004 at 7:30 am
Shouldn't that just be:
ORDER BY p.ProductId, MIN(a.AttribId)
?
--Jonathan
March 11, 2004 at 7:24 am
You can write a UDF specific to the table and column, e.g.:
USE Northwind
GO
CREATE FUNCTION dbo.f_ListCusts(@Country nvarchar(15)) RETURNS varchar(8000) BEGIN
DECLARE @List varchar(8000)
SELECT @List = ISNULL(@List + ',','') + CustomerID
FROM dbo.Orders
WHERE ShipCountry...
--Jonathan
March 11, 2004 at 6:56 am
You cannot do that because it's not logical. Once you ask for just distinct combinations, any value not included in those combinations is not defined for the result. How could...
--Jonathan
March 11, 2004 at 6:38 am
Perhaps you are using indexed views and the Arithmetic Abort setting (should be on) differs between servers or the Compatibility Level (should be 80) differs between databases.
--Jonathan
March 11, 2004 at 5:59 am
Viewing 15 posts - 61 through 75 (of 921 total)