Forum Replies Created

Viewing 15 posts - 211 through 225 (of 422 total)

  • RE: Creating my first UD

    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...

  • RE: Split a String

    Lowell (3/12/2013)


    ...the default DelimitedSplit8K is limited to a single char delimiter, which is one tripwire, since he's got dbl pipes for the delimiter. so he'd have to adapt it,...

  • RE: For every date in one table find the financial period in another table - struggling to find an answer

    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,

    ...

  • RE: Time Problem

    dajonx (3/13/2013)


    Thank you very much for your help!

    The cursor helped, but it's pegging the CPU so I still need to see if I can tune it somehow. ...

  • RE: CASE in WHERE clause

    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...

  • RE: How to total on distinct?

    Frank Cazabon (3/12/2013)


    Hi,

    I have to create a report like this:

    Deposit ID | Deposit Amount | Receipt # | Receipt Amount

    1 ...

  • RE: Client does not want to pay overtime. How to deal with it ?

    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...

  • RE: SQL concatenate

    RP_DBA (3/12/2013)


    Don't know that I completely understood the table/data setup but hopefully this at least points you in the right direction

    Select A.Col2

    , STUFF((

    SELECT',' + CONVERT(VARCHAR,c.Col1)

    FROM@TblB B

    Inner join @TblC C on...

  • RE: Date Format

    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...

  • RE: UPDATE PART OF DATA

    SELECT

    COMCOD

    ,STUFF(SIRCODE,1,2,'19') AS SIRCODE

    ,SIRDESC

    FROM

    [YourTable]

    WHERE

    LEFT(SIRCODE,2) = '18'

  • RE: Query comes to a crawl until executed using the WITH RECOMPILE option

    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...

  • RE: Repeating code over time period

    A partitioned view might be what you're looking for. Take a look at these links:

    Using Partitioned Views

    Modifying Data in Partitioned Views

     

  • RE: Performance difference between LIKE and CHARINDEX?

    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...

  • RE: What's wrong with this SQL?

    I think you need to convert the date to a string like this:

    ... , CAST(' " & dateReg & " ' AS VARCHAR(20)), ...

    Also, if any of the values...

  • RE: How to get Below T-SQL qury Output..?

    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...

Viewing 15 posts - 211 through 225 (of 422 total)