Viewing 15 posts - 616 through 630 (of 1,347 total)
>I guess not.
Guess again
UPDATE products
SET productdetail = @detail,
--Set productprice equal to itself, if @price is null
productprice = IsNull(@price, productprice)
WHERE productid = @id
[Edit]...
February 9, 2006 at 2:10 pm
Lookups can be useful if you need to look something up on a different data source.
With 2 tables in the same data source, a lookup will nearly always be slower. You can...
February 9, 2006 at 12:03 pm
Create a linked server. Read BOL topic sp_addlinkedserver
Once the link is created, T-SQL is as follows:
INSERT INTO YourTable (Column List)
SELECT Column List
FROM [LinkName].[DatabaseName].[DBOwner].[TableName]
February 8, 2006 at 4:50 pm
>>If I create the index on the array, it provides no real improvement because SQL reads from the same drive that the db is on
That part is definitely not true.
An...
February 8, 2006 at 4:38 pm
If you have a table that is left-joined, and you then apply a WHERE to that table, you force it back to an INNER JOIN. Try this:
SELECT PRODUCTS.PRODUCT_ID, PRODUCTS.P_NAME, VOTES.V_SCORE
FROM...
February 8, 2006 at 2:52 pm
For a set-based solution, you need a table of all possible numbers. You can get this by cross-joining 2 tables of known large size:
-- Limit to as many...
February 8, 2006 at 2:47 pm
You'll need to post the full SQL, including the GROUP BY.
February 8, 2006 at 12:07 pm
By changing the column list in SELECT, you potentially change the order in which rows are returned.
It may be you are just seeing a different part of the resultset.
Only way...
February 8, 2006 at 12:00 pm
If this is taking 30+ minutes on only 50K rows, then there's more going on, and most likely cardinality issues.
What is the uniqueness of field1 and field2 in the 2...
February 8, 2006 at 11:55 am
1 rounds before summing, the other sums before rounding.
If you remove decimal places before summing, and the numbers are all positive, then obviously you'll get a different number .
Sum(5.4 +...
February 8, 2006 at 11:48 am
1. Since there is no clustered index, the table may be a highly fragmented heap, requiring more disk I/O than necessary
2. If the database is running in full recovery mode,...
February 7, 2006 at 4:27 pm
IF @@ROWCOUNT = 0
BEGIN
ALTER TABLE [dbo].[RESULTS] ADD [TOTAL_VOTES] int not NULL DEFAULT (0);
UPDATE RESULTS SET TOTAL_VOTES = (OPTION1 + OPTION2 + OPTION3 + OPTION4 + OPTION5 +...
February 7, 2006 at 9:16 am
>>How do you do Dynamic SQL for the update statement? I've never done dynamic SQL...
Declare @sql varchar(1000)
if (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'RESULTS'
AND COLUMN_NAME = 'TOTAL_VOTES'
) = 0
begin
...
February 7, 2006 at 8:47 am
If you have a mix of qualified and non-qualified text fields, you are probably going to have to do some sort of data scrubbing either before or after import.
You could...
February 6, 2006 at 5:49 pm
The SQL for the "link table" (intersection table) would look something like this:
INSERT INTO Purchase_Inv_Trans
(Inv_ID, Transaction_ID)
SELECT
pi.InvoiceID, t.TransactionID
FROM [Purchase Invoices] As src
INNER JOIN Purchase_Invoice As pi
On...
February 6, 2006 at 4:51 pm
Viewing 15 posts - 616 through 630 (of 1,347 total)