Forum Replies Created

Viewing 15 posts - 181 through 195 (of 287 total)

  • RE: Asign a variable to Group by

    Try a CASE statement insead?create proc usp_Fact

    @entFact smallint

    as

    SELECT

    fac.c_fact_desc AS Service,

    SUM(CASE WHEN ods.c_prv_cve = '005' THEN 1 ELSE 0 END) AS Prov,

    CASE

    WHEN @entFact = 1...

  • RE: ISNULL(date,'-')

    Gianluca Sartori (9/1/2009)


    Do it on the application side, you don't need to do it in SQL.

    Totally agree.

    However, if you insist on doing it in SQL you can do it in...

  • RE: help using the TOP command in sql

    mish (8/12/2009)


    So does MS SQL have a TOP command then similar to the LIMIT in mySQL?

    MS SQL does have a TOP command. However, it does not have a LIMIT command....

  • RE: Transaction Advice

    AFCC Inc. Com (8/10/2009)


    Yes,

    The line item in the OrderDetail table on column ProductID can represent either the FK_ from the utbQuote table or the utbProduct table.

    The OrderDetial.ProductID should be a...

  • RE: checksums and unicode data

    The primary differnce is the way the data is stored single-byte versus double-byte.

    It just so happens that the checksum algorithmn generates duplicates in this particular case.

  • RE: Stored Procedures

    I never had good luck with the RAND() function. I'd suggest using NEWID() for generating random data.

    http://sqlblogcasts.com/blogs/madhivanan/archive/2008/04/04/populating-sample-data.aspx

    For example:SELECT ABS(CHECKSUM(NEWID())) % 10000 as IntegerVal

  • RE: PK violation but still a commitable transaction

    Naw, probably not much different than doing a junk log.

    My thought was that it seemed like good form to wrap it in a try-catch. Then if,in the future we ever...

  • RE: Using the Over Partion to create an instance count

    This works for the sample data, but that might just be luck.. 🙂SELECT

    *,

    ROW_NUMBER() OVER (PARTITION BY R1, cancellation ORDER BY Date) AS

    FROM

    (

    SELECT

    *,

    ROW_NUMBER() OVER (ORDER BY [Date])

    - ROW_NUMBER() OVER...

  • RE: new to cusrors still cant get 1st right

    can you elaborate on this part? I don't understand the business rules:

    need to get to records per policy number based on

    --if they baded the preimium for peronal_property, if it...

  • RE: Try-catch issue?

    What happens when you run this:BEGIN TRY

    DECLARE @sql VARCHAR(4000)

    SET @sql = 'bulk insert flibbityflooo

    ...

  • RE: Why cursors

    I suspect that the SQL devs wanted a way to do bad things like allocate lots of memory and never let it go to see how long the server would...

  • RE: PK violation but still a commitable transaction

    There are tons of ways to handle errors.. Personally I do not use the XACT_STATE. That doens't mean it isn't valuable. But, I guess that might depend on the complexity...

  • RE: help with limiting results in query

    How do you define "First" from the 21_view_po_line_schedule table?

    This might help guide you..?

    SELECT

    inv_mast.item_id,

    inv_mast.item_desc,

    inv_loc.stockable,

    inv_loc.qty_on_hand,

    inv_loc.qty_backordered,

    inv_loc.location_id,

    p21_view_po_line_schedule.release_date,

    p21_view_po_line_schedule.release_qty,

    p21_view_po_line_schedule.qty_received

    FROM

    inv_loc

    INNER JOIN inv_mast

    ON inv_mast.inv_mast_uid = inv_loc.inv_mast_uid

    INNER JOIN p21_view_po_line

    ON inv_loc.inv_mast_uid = p21_view_po_line.inv_mast_uid

    INNER JOIN

    (

    SELECT TOP 1

    release_date,

    release_qty,

    qty_received,...

  • RE: Try-catch issue?

    Humm.. it seems to be working for me:BEGIN TRY

    DECLARE @sql VARCHAR(4000)

    SET @sql = 'bulk insert users

    from ''C:\Documents and Settings\jdgonzalez\Desktop\users_mod.txt''

    with (firstrow...

  • RE: Try-catch issue?

    As far as I know you cannot directly trap a terminal error. SSIS is probably a better bet.

    However, I did find a post about nesting stored procs to capture...

Viewing 15 posts - 181 through 195 (of 287 total)