SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
DatabaseImport

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
DatabaseImport
Author Message
Gennadiy



Joined: 13 Jun 2002
Posts: 18

Post DatabaseImport Reply with quote

Hello,

We use DatabaseImport to import data from file into databse table ( sybase 12)
When we login as 'sa' it works fine, but when we use user id we were recieving error %'Please insure that you have a primary key on that table ...'%.

We do have a primary key and we granted permissions to this user.

Thanks,
Gennadiy

Wed Aug 21, 2002 10:52 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7949

Post Re: DatabaseImport Reply with quote

The user should be granted permissions to select from sysobjects, sysindexes and syscolumns.

: Hello,

: We use DatabaseImport to import data from file into databse table ( sybase
: 12)
: When we login as 'sa' it works fine, but when we use user id we were
: recieving error %'Please insure that you have a primary key on that table
: ...'%.

: We do have a primary key and we granted permissions to this user.

: Thanks,
: Gennadiy

Wed Aug 21, 2002 11:03 am View user's profile Send private message
Gennadiy



Joined: 13 Jun 2002
Posts: 18

Post Re: DatabaseImport Reply with quote

The user granted to these objects and the message populated again.

exact message:

line 31: result set is not updateable, specified table must have a primary key"

line 31 in JAL sscript :

line 29: DatabaseSave( "c:\\temp\\file_name.CSV", "CSV", rows )
line 31: DatabaseImport("db_name..e_tbale_name", "c:\\temp\\file_name.csv", rows)

is any idea?

Thanks,
Gennadiy.

: The user should be granted permissions to select from sysobjects, sysindexes
: and syscolumns.

Wed Aug 21, 2002 12:27 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7949

Post Re: DatabaseImport Reply with quote

Is this table owned by dbo?

Have you tried db_name..e_tbale_name

DatabaseImport("db_name.dbo.e_tbale_name", ...)
or simply DatabaseImport("e_tbale_name", ...) ?

: The user granted to these objects and the message populated again.

: exact message: line 31: result set is not updateable, specified table must
: have a primary key"

: line 31 in JAL sscript : line 29: DatabaseSave(
: "c:\\temp\\file_name.CSV", "CSV", rows )
: line 31: DatabaseImport("db_name..e_tbale_name",
: "c:\\temp\\file_name.csv", rows)

: is any idea?

: Thanks,
: Gennadiy.

Wed Aug 21, 2002 12:43 pm View user's profile Send private message
Gennadiy



Joined: 13 Jun 2002
Posts: 18

Post Re: DatabaseImport Reply with quote

Yes,

this table owned by dbo
and I tried different way that you described below and it did not work.

and also I delete rows from the script:

ConcatEx "delete db_name..e_table_name where client in ('MM','C_MM') and bus_date = '", bus_date, "'", query
DatabaseExecute(query, rows)

This script works fine.

-Gennadiy

: Is this table owned by dbo?

: Have you tried db_name..e_tbale_name

: DatabaseImport("db_name.dbo.e_tbale_name", ...)
: or simply DatabaseImport("e_tbale_name", ...) ?

Wed Aug 21, 2002 12:52 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7949

Post Re: DatabaseImport Reply with quote

Before importing data into a table 24x7 retrieves that table definition and checks whether the current user has dbo role or owns the table. If yes, it checks if that table has a primary key or unique index.

If you cannot alias that user to dbo you can the following workaround:
Create a table in the user's schema.
Import into that table and then move data to the main dbo table.

If the database has "builb insert/select into" option enabled you don't event need a permanent table you can use the following technique

DatabaseExecute("SELECT * INTO #temp FROM dbo.e_table_name WHERE 0 = 1", rows)
DatabaseExecute("CREATE unique index i ON #temp(column names here)", rows)
DatabaseImport("#temp", "c:\\temp\\file_name.csv", rows)
DatabaseExecute("INSERT INTO dbo.e_table_name SELECT * FROM #temp", rows)
DatabaseExecute("DROP TABLE #temp", rows)

: Yes,

: this table owned by dbo
: and I tried different way that you described below and it did not work.

: and also I delete rows from the script: ConcatEx "delete
: db_name..e_table_name where client in ('MM','C_MM') and bus_date =
: '", bus_date, "'", query
: DatabaseExecute(query, rows)

: This script works fine.

: -Gennadiy

Wed Aug 21, 2002 1:14 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.