SPONSORS:






User Tag List

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Junior Member
    Join Date
    Jan 2002
    Location
    Hyderabad
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error when Retrieving GUID\'s from data base

    Hi,
    i'm using silk 5.5 sp2 and sql 2000.
    I'm not able to reterive user defined data type field values.
    In a Table Items,
    ITem_ID is of GUID_KEY data type, when i'm trying to retrieve values of this column silk is throwing following error
    "Error: SQL_TYPE (-11) in column (Item_ID) not supported"

    Is there any other way to retrieve values from user definded data types.

    ------------------
    Raj
    Raj

  2. #2
    Guest

    Re: Error when Retrieving GUID\'s from data base

    Could you elaborate more on this?

    Are you using Silk Test's DB features to extract data? Could you post the example code you are using?

  3. #3
    Junior Member
    Join Date
    Jan 2002
    Location
    Hyderabad
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Error when Retrieving GUID\'s from data base

    I'm Db functions:
    [-] testcase sample() appstate none
    [ ] String DSNName = "Merc_db"
    [ ] String Item_Number =""
    [ ] String Item_Name = ""
    [ ] AnyType Item_ID
    [ ]
    [ ]
    [ ]
    [ ]
    [ ] HDATABASE hdbc = DB_Connect("DSN={DSNName};UID=Mercury;PWD=Mercury" )
    [ ]
    [ ] HSQL hstmnt = DB_ExecuteSql (hdbc, "SELECT Item_ID,Item_Number FROM mrc_Items")
    [ ]
    [-] while (DB_FetchNext(hstmnt,Item_ID,Item_Number))
    [ ] print ("Item Number : {Item_Number} ***** Item Name: {Item_ID}") //
    [ ] DB_FinishSQL (hstmnt)
    [ ]


    ------------------
    Raj
    Raj

  4. #4
    Junior Member
    Join Date
    Jun 2004
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Error when Retrieving GUID\'s from data base

    I am also having this problem and cannot find another solution elsewhere on the forum. I am using DB_ExecuteSql to execute a sql statement that is retrieving an objectId that looks something like {D819BD81-4B46-4530-881F-D8E35E2CA95F}. I am getting the same SQL_TYPE (-11) error as described above.

    Here are a couple of lines from my code:
    [ ] hstmnt = DB_ExecuteSql(hdbc, "SELECT {objectid} FROM {dbview} WHERE {keyCol} = '{dbkeyVal}'")

    [-] if (DB_FetchNext(hstmnt, value))
    //do stuff

    Is there any way to get this guid out of the sql database?

    ----------
    Donna

  5. #5
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Error when Retrieving GUID\'s from data base

    Try casting it (within the sql) to a different datatype, one that silktest can understand?

  6. #6
    Junior Member
    Join Date
    Jun 2004
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Error when Retrieving GUID\'s from data base

    I am not sure I understand... I am still very new to SilkTest. Do you mean something like this?

    if (DB_FetchNext(hstmnt, [ANYTYPE]value))
    //do stuff

    When I do this, I get an error that says, "*** Error: Variable (value) has not been set"

    Am I missing something?

  7. #7
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Error when Retrieving GUID\'s from data base

    No, I mean to do the cast in the sql statement. Something like:
    "SELECT Str({objectid}) FROM {dbview} WHERE {keyCol} = '{dbkeyVal}'"
    Though I admit I'm not familiar with the guid_key datatype, so don't know whether it should usefully be cast to string, or to a number, or what.

  8. #8
    Junior Member
    Join Date
    Jun 2004
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Error when Retrieving GUID\'s from data base

    When I cast it to a string as suggested above, I get the following error: "*** Error: (22018) [Microsoft][ODBC SQL Server Driver][SQL Server]Operand type clash: uniqueidentifier is incompatible with float"

    Can anyone explain what this means? The data from SQL that is being returned from this query is of type uniqueidentifier (according to SQL). Does Silk think the type is a float? If so, how do I cast that so it would be recognized and valid?

  9. #9
    Super Member
    Join Date
    Jul 2003
    Location
    Boulder, CO
    Posts
    1,276
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Error when Retrieving GUID\'s from data base

    This looks like it might cause problems to me:

    "SELECT Str({objectid}) FROM {dbview} WHERE {keyCol} = '{dbkeyVal}'"

    It seems like it should be:

    "SELECT {Str({objectid})} FROM {dbview} WHERE {keyCol} = '{dbkeyVal}'"

    which is too complicated for me.

    I would suggest doing this (just in case):

    STRING objString = Str({objectid})
    "SELECT {objString} FROM {dbview} WHERE {keyCol} = '{dbkeyVal}'"

    Even better would be to build up your entired SQL query in a STRING that you can echo out. This way you can use another utility to execute your query and make sure that it works.

    What are your declarations for keyCol & dbkeyVal? keyCol would need to be STRING and dbkeyVal would probably also be STRING, but maybe INTEGER (not FLOAT!)
    Chris R Mead

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

  10. #10
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Error when Retrieving GUID\'s from data base

    It does cause problems, but only because the Str() function is only for use with numeric datatypes. It turns out that the way to convert a guid into a string within the sql is to use the convert() function, like this:
    "SELECT Convert(varchar(36), {objectid}) FROM {dbview} WHERE {keyCol} = '{dbkeyVal}'".
    This works with MSSQL 2000, I don't know about any other platforms.

 

 
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
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:30 AM.

Copyright BetaSoft Inc.