Results 1 to 2 of 2

Thread: SQL Query Transformation

  1. #1
    Join Date
    Mar 2007
    Posts
    1

    Post SQL Query Transformation

    I am importing user id's from CSV file into my Database. The source user id is of 4 character long and the destination user_id field is of 100 varchar. I just query the data so that i wan'a check that is said user id is already exist in the database or not . So i got this error. Read the script and error below
    '************************************************* *********************
    ' Visual Basic Transformation Script
    '************************************************* ***********************

    ' Copy each source column to the destination column
    Function Main()

    DIM v_user_id,rs, ConStr,sql
    set rs = CreateObject("Adodb.Recordset")
    set con = CreateObject("Adodb.Connection")

    ConStr = "Provider=SQLOLEDB;Server=192.168.1.71;Database=te stkaanza;uid=sa;pwd=sa"
    v_user_id = DTSSource("Col001")
    rs.open "Select user_id from tbl_gc_user_hdr where user_id = " + v_user_id,ConStr,0,1

    if Not rs.eof then
    MsgBox "Record Found"
    else
    MsgBox "Record Not Found"
    end if
    rs.Close
    End Function

    i got error from this line :
    rs.open "Select user_id from tbl_gc_user_hdr where user_id = " + v_user_id,ConStr,0,1

    Error message :

    Error Source: Microsoft OLE DB Provider for SQL Server
    Error Description:The conversion of the varchar value '1000015151910165' overflowed an int column. Maximum integer value exceeded.
    Error Help File:
    Error Help Context ID:0

    Thank you in advance

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    instead do this
    Select count(user_id) as Mycount from tbl_gc_user_hdr where user_id = " + v_user_id,ConStr,0,1

    and check

    if rs("Mycount") >0
    MsgBox "Record Found"
    else
    MsgBox "Record Not Found"
    end if

Posting Permissions

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