Forum Replies Created

Viewing 15 posts - 13,741 through 13,755 (of 13,848 total)

  • RE: Convert varchar(50) to money or decimal

    Something like this?

    declare @a varchar(50), @b-2 varchar(50)

    set @a = '+002345'

    set @b-2 = '-002345'

    select cast(@a as decimal(19,2)) as 'a', cast(@b as decimal(19,2)) as 'b'

    Regards

    Phil

  • RE: Insert Trigger

    Not quite sure I understand what you're trying to do. You say that this is an INSERT trigger - ie a trigger which is run when a new record...

  • RE: Casting Date/Time as string, padding empty chars with 0.

    Anne's nearly got it.

    Try this:

    select replace(convert(varchar(12),getdate(),114),':','')

    Regards

    Phil

  • RE: Determine character in database field

    Presumably you have a reason for using fixed-width files rather than [tab] or [comma] delimited? A mainframe background, perhaps

    When you open the fixed-width...

  • RE: Help With a query

    Here's another version that does not require any joins:

    Select ClientID from ClientRegs

    where RegionID = 1 or RegionID = 28

    group by ClientID

    having count(ClientID) > 1

    Regards

    Phil

  • RE: Casting Date/Time as string, padding empty chars with 0.

    Hi Val

    It seems that your original statement is nearly giving you what you want, except that you have spaces where you want zeroes to appear. So can you just...

  • RE: Renaming a field with constraint

    Not sure how you are achieving this - Enterprise Manager or Query Analyser? I would expect the sp_rename stored procedure to work the fastest via QA. It was...

  • RE: Renaming a field with constraint

    Hi Bernard - what sort of constraint? Some constraints (eg PK, FK) do not need to be dropped before renaming fields.

    Otherwise, can't you just drop the constraint, rename the...

  • RE: Determine character in database field

    I must admit - I just assumed that a field called GivenName would be a string

    DATALENGTH is a more general function, as it...

  • RE: Update/Insert Records From Daily File - How?

    If I work on the assumption that you have a table 'tblNewRecords' that contains the daily updates, you can work along these lines:

    --First do the updates

    update all

    set all.* = new.*...

  • RE: Determine character in database field

    Sounds like a process/application change to me. Hardware should have nothing to do with this.

    As far as testing for invisible characters is concerned, you were on the right track...

  • RE: Determine character in database field

    Could it be a zero-length string? Try running

    select *

    from table where id = 12345 and GivenName = ''

    If the record is still returned, you've cracked it.

    Regards

    Phil

  • RE: Cursor or the While loop?

    Hi Maria

    Something like this gets rid of the cursor and does everything in far fewer statements:

    update wtp

    set MinDate = (SELECT min(wtf.create_dt) FROM WT_ESPP_FACT wtf

    ...

  • RE: Cursor or the While loop?

    Hi Maria, had a quick look at this and I think it can be re-coded, without needing a cursor and using fewer lines of code. However, no time at...

  • RE: Cursor or the While loop?

    Can you expand a bit on what your problem is? Many people here try to avoid cursors as much as possible, for performance reasons, but sometimes you just have...

Viewing 15 posts - 13,741 through 13,755 (of 13,848 total)