Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VERY big prob with filed conversion (2000)

    In a Sql table (for error have sett to the default a filed in nvarchar PROVA6)
    Now i have a milion of records in nvarcvhar but rially i want to use this filed in decimal number...
    Is possible witha sql command via script or via Sql Manager Express to convert all record from nvarchar to decimal number??????
    Attached image...

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VERY big prob with filed conversion (2000)

    You could execute an SQL statement:

    ALTER TABLE dbo.SCHEDA ALTER COLUMN PROVA6 Real

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VERY big prob with filed conversion (2000)

    Error(!?) see image...

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VERY big prob with filed conversion (2000)

    Does the field contain values that cannot be converted correctly?

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VERY big prob with filed conversion (2000)

    Now... have deleted the column PROVA6!(the project is in test)
    I get the value from a CICS screen with:

    SCELTA = Empty
    SCELTA = CDbl(Trim(Format(SESS0.Screen.GetString(Y, 38, 14), "#,##0.00"))) '* 1

    and have dimensioned the var as doble.

    the var after getting the scree are filled:

    SCELTA = 7812,96

    now i want to insert in the field prova6 this value in format: #,##0.00 to finally have in prova6 7.812,96

    1) wath is the correct dim of variable?
    2) how top set the filed in Sql Table?

    tks.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VERY big prob with filed conversion (2000)

    1) Dim SCELTA As Double

    2) Have you already created a new field PROVA6 of type Real?

  7. #7
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VERY big prob with filed conversion (2000)

    In other case i have error in image....

    i use this part of code to insert value in table
    SCELTA = Empty
    SCELTA = Trim(Format(SESS0.Screen.GetString(Y, 38, 14), "#,##0.00")) '* 1
    'SCONF
    SPORT_SEC = Empty
    SPORT_SEC = Trim(Format(SESS0.Screen.GetString(Y, 53, 14), "#,##0.00")) '* 1
    'FENOM
    PORTAFOGLIO = Empty
    PORTAFOGLIO = Trim(SESS0.Screen.GetString(Y, 73, 9))
    'GG
    TROVATA = Empty
    TROVATA = Trim(SESS0.Screen.GetString(Y, 67, 5))

    SQL1 = vbNullString
    SQL1 = "INSERT INTO SCHEDA (PROVA1,PROVA2,PROVA3,PROVA4,PROVA5,PROVA6,PROVA7, PROVA8,PROVA9,PROVA10,PROVA11,PROVA12,PROVA13,PROV A14)VALUES('" & MERCATO_1 & "','" & ID_FLUSSO & "','" & PARAM_1 & "','" & PARAM_2 & "','" & ID_FLUSSO1 & "','" & SCELTA & "','" & SPORT_SEC & "','" & PORTAFOGLIO & "','" & TEST_DATA & "','" & DATA_CORRENTE & "','" & TROVATA & "','" & NOMINATIVO & "','" & PORTAFOGLIO1 & "','" & DESCRIZIONE & "')"
    CNSQL.Execute SQL1

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VERY big prob with filed conversion (2000)

    On which line does the error occur?

  9. #9
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VERY big prob with filed conversion (2000)

    CNSQL.Execute SQL1...
    sorry for delay.

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VERY big prob with filed conversion (2000)

    Since SCELTA is a number, you shouldn't put single quotes around it. So instead of
    <code>
    ... "','" & SCELTA & "','" ...
    </code>
    you should use
    <code>
    ... "'," & SCELTA & ",'" ...
    </code>
    and similar for other numeric fields if you have them.

  11. #11
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VERY big prob with filed conversion (2000)

    please Hans adjust for me the Sql, have error and error in sql, the var are SCELTA and SPORT_SEC...
    Tks for patience.

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VERY big prob with filed conversion (2000)

    I've shown you how to do it for SCELTA, you can do the same for SPORT_SEC.

  13. #13
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VERY big prob with filed conversion (2000)

    SQL1 = "INSERT INTO SCHEDA (PROVA1,PROVA2,PROVA3,PROVA4,PROVA5,PROVA6,PROVA7, PROVA8,PROVA9,PROVA10,PROVA11,PROVA12,PROVA13,PROV A14)VALUES('" & MERCATO_1 & "','" & ID_FLUSSO & "','" & PARAM_1 & "','" & PARAM_2 & "','" & ID_FLUSSO1 & "'," & SCELTA & ",'" & "'," & SPORT_SEC & ",'" & PORTAFOGLIO & "','" & TEST_DATA & "','" & DATA_CORRENTE & "','" & TROVATA & "','" & NOMINATIVO & "','" & PORTAFOGLIO1 & "','" & DESCRIZIONE & "')"

    Modified but go in sintiax error...

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VERY big prob with filed conversion (2000)

    You now have
    <code>
    & ",'"
    </code>
    twice after SCELTA. It should be
    <code>
    ... SCELTA & "'," & SPORT_SEC ...</code>

  15. #15
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VERY big prob with filed conversion (2000)

    but to understand correctcly...
    warth is the cahracter who dilimit each var in sql?
    comma or...

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •