Viewing 15 posts - 16 through 30 (of 275 total)
I agree: AFAIK, the only restriction on the number of variables is memory space.
Scott Pletcher, SQL Server MVP 2008-2010
November 23, 2010 at 10:07 am
Maybe:
ORDER BY LEN( Number ) DESC
Scott Pletcher, SQL Server MVP 2008-2010
November 23, 2010 at 10:05 am
It sounds as if you do need two LEFT OUTER JOINs, as Wayne suggested.
Other than that, sorry, I give up. Hopefully s/o else can help you.
Scott Pletcher, SQL Server MVP 2008-2010
November 23, 2010 at 9:46 am
Please try running this:
SELECT glbank.check_num
, glbank.ref_num
, glbank.check_amt
, glbank.check_date
, glbank.bank_code
, vendaddr.[name]
, vendor.vend_num
, vendor.vend_remit
FROM((aptrxp_all
INNER JOIN glbank
ON aptrxp_all.check_num=glbank.check_num)
INNER JOIN vendaddr
ON aptrxp_all.vend_num=vendaddr.vend_num)
INNER JOIN vendor
ON (vendaddr.vend_num IS NOT NULL AND...
Scott Pletcher, SQL Server MVP 2008-2010
November 23, 2010 at 8:58 am
Yes, that's right.
You could consider the LEFT/RIGHT table as the "always" side of the JOIN, with the other, un-named side being the "optional" side.
So, back to your q 2), breaking...
Scott Pletcher, SQL Server MVP 2008-2010
November 22, 2010 at 4:50 pm
INNER JOIN vendor
ON (vendaddr.vend_num IS NOT NULL AND vendaddr.vend_num=vendor.vend_num)
OR (vendaddr.vend_num IS NULL AND vendaddr.vend_remit=vendor.vend_remit)
Scott Pletcher, SQL Server MVP 2008-2010
November 22, 2010 at 4:38 pm
Use CONVERT:
SELECT LEFT(CONVERT(varchar(16), amount, 1), LEN(CONVERT(varchar(16), amount, 1)) -3) AS Amount
FROM (
SELECT CAST(1234567.8901 AS money) AS amount
UNION ALL
SELECT...
Scott Pletcher, SQL Server MVP 2008-2010
November 15, 2010 at 3:18 pm
Of course if the duplicates are both in the same batch you are inserting -- which sounds extremely likely in the scenario you are presenting -- that code won't solve...
Scott Pletcher, SQL Server MVP 2008-2010
November 12, 2010 at 4:15 pm
If Results holds other values than 0 to 3, the COUNT(*) in your query would show a different result than what the OP currently will get.
Quite. I...
Scott Pletcher, SQL Server MVP 2008-2010
November 11, 2010 at 12:00 pm
You might add one further refinement to Lutz's excellent query, depending on whether Results column could ever have other values:
SELECT
COUNT(*)...
Scott Pletcher, SQL Server MVP 2008-2010
November 10, 2010 at 4:40 pm
You could use a trigger on a custom table built to allow it to fire off other procs with params.
That's not especially easy or clean, but it will work.
It's difficult...
Scott Pletcher, SQL Server MVP 2008-2010
November 10, 2010 at 4:30 pm
Does your book tell you what version of SQL Server? If it's SQL 2000, the answer will be different.
Scott Pletcher, SQL Server MVP 2008-2010
November 9, 2010 at 12:13 pm
Very nice! You can shorten it up a bit though 🙂
DECLARE @minutesSinceSQLStarted int
SELECT @minutesSinceSQLStarted = DATEDIFF(MINUTE,
-- determines when tempdb was created (done at startup) ...
Scott Pletcher, SQL Server MVP 2008-2010
November 5, 2010 at 3:54 pm
AND fs.Currency IN (SELECT item FROM dbo.ABN_fnSplitChar(@Currency,','))
Maybe the 'GBP' row(s) are being excluded by another condition ... this does start with "AND" 🙂
Scott Pletcher, SQL Server MVP 2008-2010
November 5, 2010 at 3:20 pm
From a performance standpoint, are you better off putting the calcs on GETDATE() directly in the SQL rather than using variables? I would hope that SQL's optimizer would realize...
Scott Pletcher, SQL Server MVP 2008-2010
October 29, 2010 at 3:30 pm
Viewing 15 posts - 16 through 30 (of 275 total)