Forum Replies Created

Viewing 15 posts - 541 through 555 (of 627 total)

  • RE: bug in SQL Server view

    Did you copy and paste my code and tried it?

    My results are:

    c1c2Termstotal

    533RobinNULL533.00

    655SteveNULL655.00

  • RE: Problems with a SPROC

    Sorry the VARCHAR(6) should have been a giveaway.

    Hmmm...with the IF statement being Identical it is puzzling but without any more info I'm not sure.

    Just another shot in the dark here...

  • RE: bug in SQL Server view

    Try this:

    --Create table test

    CREATE TABLE [dbo].[test](

    [c1] [varchar](30) NULL,

    [c2] [varchar](20) NULL

    ) ON [PRIMARY]

    --Insert values in to the test table

    Insert into test values ('533','Robin')

    Insert into test values ('655','Steve')

    GO

    --Create View

    create view [dbo].[test_vw]

    as

    select *,...

  • RE: Problems with a SPROC

    Are you sure your predicates are identical in both IF clauses. In your test you set your parameters but I can't tell if you used those exact values in...

  • RE: SQL Server Recovery & Excessive Free Space

    The database size will not change no matter how many rows you delete. To better understand this you should do some research on how SQL actually stores data. ...

  • RE: Find appointments within 7 days, excluding weekends.

    RP_DBA (6/16/2015)


    Using Jun 1 and Jun 8 as your dates, DATEDIFF would meet 7 day criteria but includes weekends. Something like this might work?

    DECLARE @StartDate DATE = '20150601'

    ,@EndDate DATE =...

  • RE: Indexing Dates

    This should work:

    NOTICE - I purposely created a gap for CBA to demonstrate.

    DECLARE @test-2 TABLE ([Index] INT, FactorS NVARCHAR(3), Value DECIMAL(2,1), [Date] DATE)

    INSERT INTO @test-2 ([Index],...

  • RE: Indexing Dates

    GilaMonster (6/16/2015)


    yb751 (6/16/2015)


    If so than you could (ironically) make use of the LAG function. Otherwise Jeff's solution will work just fine.

    Unless I'm missing something, LAG won't produce the results...

  • RE: converting NULL

    EDIT: Sorry I misunderstood the question.

  • RE: Indexing Dates

    Robert klimes (6/16/2015)


    you are not very clear in what your requirements are? you want to determine the lag values in reference to what?

    read the post at the link in my...

  • RE: Find appointments within 7 days, excluding weekends.

    Fairly straightforward, try this:

    SELECT

    MRN,

    DischargeDate,

    ApptDate,

    DATEDIFF(dd,DischargeDate,ApptDate) AS DayDifference

    From

    Test

    WHERE

    DATEDIFF(dd,DischargeDate,ApptDate) <= 7

    LOL, I feel like I'm answering a question for a former employer. (I used to be in Healthcare)

  • RE: Help me with the SQL SYNTAX Please

    6 single quotes does work as a replacement string because...

    '<-Outside quotes contain your string->'

    The 2nd & 3rd '' will become a single quote because the 2nd is used to...

  • RE: Help me with the SQL SYNTAX Please

    It's a little tricky to demonstrate because you have to escape the single quote in the example itself but the execution is fairly simple.

    DECLARE @quotedString NVARCHAR(10) = 'ABC''DEF''GHI'

    SELECT REPLACE(@quotedString,'''','"');

  • RE: Problem in procedure

    Michael L John (6/15/2015)


    yb751 (6/15/2015)


    Did you try using GO?

    Example:

    First SP

    GO

    Second SP

    This will not work inside a procedure.

    Can you post your code?

    Darn...missed that in the OP

  • RE: Problem in procedure

    Did you try using GO?

    Example:

    First SP

    GO

    Second SP

Viewing 15 posts - 541 through 555 (of 627 total)