Forum Replies Created

Viewing 15 posts - 1 through 15 (of 191 total)

  • Reply To: Optimize Cursor

    When I run Scott's code, I get this error msg?

    Msg 156, Level 15, State 1, Line 6

    Incorrect syntax near the keyword 'RowCount'.

    Msg 156, Level 15, State 1, Line 8

    Incorrect syntax...

  • Reply To: Optimize Cursor

    This is a sample of the data:

    --===== If the test table already exists, drop it
    IF OBJECT_ID('TempDB..#mytable','U') IS NOT NULL
    ...
  • Reply To: Name columns for a pivot

    Jonathan, This works great!  thanks!

  • Reply To: Name columns for a pivot

    I think it works better with the pivot because I am joining it to create a new table...

    Into POInfo 
    From MeritusMmPO as PO
    Left Join MeritusMmPOLines as...
  • Reply To: Name columns for a pivot

    This is the input data:

    This is what I would like it to look like:

     

  • Reply To: Name columns for a pivot

    That worked...thanks!

    I have a separate related issue now.

    The data looks like this

    When I run this code:

    Select SourceID, PurchaseOrderID, [1]...
  • Reply To: Excecute dynamic

    I found my own answer!  I had an issue with the ID column.  Fixed that and issue resolved.

  • Reply To: get year/month min/max from dates

    What format are the dates in? datetime (12/29/2019 00:00:00)

    How would you know which columns to interrogate? I don't, I'm thinking any column that contains a "/" in it as a...

  • Reply To: Scientific number in varchar column

    Jeff, that would be the best case scenario, but we get many clients that give to us as is and don't want to do more.  It is in excel and...

  • Reply To: Scientific number in varchar column

    looks like I have some data too large to convert to numeric because I am getting this error:

    Invoice = coalesce(cast(cast(try_cast([Vendor invoice] As float) As numeric(38,0)) As varchar(50)), [Vendor invoice]),

    error:

    Arithmetic overflow...

  • Reply To: Scientific number in varchar column

    Frederico,

    The issue is, it doesn't work.

    I get this error:

    Arithmetic overflow error converting float to data type numeric.

    When I try this line below:

    Case When [Vendor invoice] Like '%E+%' Then Cast(Convert(numeric(24,0), Cast([Vendor...

    • This reply was modified 2 years, 8 months ago by  GrassHopper.
  • Reply To: Scientific number in varchar column

    Phil, those are excluded from conversion...I'm just showing what is in the data.  The only ones that would be converted would be the numbers with E+ in it.  This also...

    • This reply was modified 2 years, 8 months ago by  GrassHopper.
  • Reply To: Scientific number in varchar column

    The original column is a varchar type. I want to convert the scientific number to a number without scientific notation (i.e. 38784939843) and I want the value to remain in...

    • This reply was modified 2 years, 8 months ago by  GrassHopper.
  • Reply To: Dynamic Insert Command

    SQLian and Thom, Thank you! both.  I wish i could set both to the answer but it only lets me set 1 of them.  I've learned something from both of...

  • Reply To: Dynamic Insert Command

    Thom,

    Thanks for getting me 99% therre, but I'm not getting the list of the field names, just 1 field name appears in the list on the insert and select side. ...

    • This reply was modified 2 years, 10 months ago by  GrassHopper.
    • This reply was modified 2 years, 10 months ago by  GrassHopper.
    • This reply was modified 2 years, 10 months ago by  GrassHopper.
    • This reply was modified 2 years, 10 months ago by  GrassHopper.

Viewing 15 posts - 1 through 15 (of 191 total)