Viewing 15 posts - 211 through 225 (of 422 total)
You might be able to make use of this Currency Formatter Function[/url].
This will let you enter values like this:
SELECT * FROM tvfUniversalCurrencyFormatter(123456789.23,'US',0)
with result: 123,456,789.23
or SELECT * FROM tvfUniversalCurrencyFormatter(123456789.23,'GB',1)
with result: £123,456,789.23
or...
March 13, 2013 at 11:15 pm
Lowell (3/12/2013)
March 13, 2013 at 9:59 pm
I made some guesses...is this what you were trying to do?
Some sample data.
IF OBJECT_ID('tempdb..#SalesOrders') IS NOT NULL
DROP TABLE #SalesOrders
CREATE TABLE #SalesOrders (
[OrderID] INT IDENTITY(1,1) NOT NULL,
...
March 13, 2013 at 2:49 pm
dajonx (3/13/2013)
The cursor helped, but it's pegging the CPU so I still need to see if I can tune it somehow. ...
March 13, 2013 at 1:57 pm
Personally, if the where clause is that complex I like the idea of just using an IF statement like in your second example if for no other reason that it...
March 12, 2013 at 2:24 pm
Frank Cazabon (3/12/2013)
I have to create a report like this:
Deposit ID | Deposit Amount | Receipt # | Receipt Amount
1 ...
March 12, 2013 at 1:52 pm
It's been about 6 years since I was a totally independent contractor, but I did that for more than 20 years. During those times if I was working for an...
March 12, 2013 at 1:47 pm
RP_DBA (3/12/2013)
Select A.Col2
, STUFF((
SELECT',' + CONVERT(VARCHAR,c.Col1)
FROM@TblB B
Inner join @TblC C on...
March 12, 2013 at 1:28 pm
Here's a similar function with more options that is an inline tvf rather than scalar. The benefits of that should be obvious. I didn't write the original code (and can't...
March 11, 2013 at 11:04 am
SELECT
COMCOD
,STUFF(SIRCODE,1,2,'19') AS SIRCODE
,SIRDESC
FROM
[YourTable]
WHERE
LEFT(SIRCODE,2) = '18'
March 10, 2013 at 7:22 pm
Try:
SELECT
is_auto_update_stats_on
,is_auto_update_stats_async_on
FROM sys.databases
If auto update stats is on and the statistics get out of date the query optimizer will always wait for...
March 10, 2013 at 7:05 pm
A partitioned view might be what you're looking for. Take a look at these links:
Modifying Data in Partitioned Views
March 10, 2013 at 6:30 pm
I was curious so I set up a test table with 100,000 rows of random names with some double-names (i.e., with an ampersand) randomly thrown in.
I tested selecting the rows...
March 10, 2013 at 2:49 pm
I think you need to convert the date to a string like this:
... , CAST(' " & dateReg & " ' AS VARCHAR(20)), ...
Also, if any of the values...
March 9, 2013 at 11:33 am
Try this. Without test data I wasn't able to test it so it's just an idea off the top of my head.
DECLARE @FromDate DATETIME
DECLARE @EndDate DATETIME
SET @FromDate = '2013-01-01 00:00:00.000'
SET...
March 9, 2013 at 11:14 am
Viewing 15 posts - 211 through 225 (of 422 total)