Select to view content in your preferred language

Update an registered table with SQL?

1103
9
12-29-2010 12:38 AM
gismoe
by
Frequent Contributor
I have to alter (truncate and refill) a table on my SQL Server 2008 every night. The table is used as event layer; so an objectid is needed.

But trying to "select...... into.....from" doesn't work because the objectid is missing.

I found this page Editing nonversioned geodatabase data in SQL Server using SQL but this seems to work only for one dataset. I have to alter 30.000 datasets with an unique ID and i don't want to write an SQL-Statment with 30.000 lines.

So my simple question: How to alter an registered table with "select...... into.....from"?


Because of the lost of permissions i don't want to delete and create the table.


Any suggestions?
0 Kudos
9 Replies
VinceAngelo
Esri Esteemed Contributor
Generally "update" means something different when referring to SQL.

Do you mean 30k *rows* or 30k *tables*?

If you replace the table contents daily you should consider registering the table with
a USER-set rowid.

Why don't you just take the extra step to make a point layer from the table?  Event
layers don't have a spatial index, which means they are generally slower.  Loading
30k points into ArcSDE takes just seconds, and the API takes care of the registered
column.

- V
0 Kudos
gismoe
by
Frequent Contributor
Oh yes, you're right. My SQL-terms are unintelligible.

I have to replace the table contents of 30.000 rows daily with BIDS. The table has to be used by different software applications. ArcGIS is the only GIS. Other applications wouldn't like a feature class. I think the speed is ok.

Maybe i want to create a FC later... Is there a command to make a point feature class, so it can run in batch?

Otherwise i was able to register/unregister my table with the sdetable-command. Thanks a lot!
BTW: Why can I do not set the USER-set rowid with ArcCatalog?

I'am wondering that some commands are only possible with ArcGIS/ArcCatalog and others only with this sde-tools.
0 Kudos
VinceAngelo
Esri Esteemed Contributor
ArcObjects can specify a USER-set objectid, it's just not in the GUI.

- V
0 Kudos
VinceAngelo
Esri Esteemed Contributor
If you use SQL-Server 2008, you can use the native GEOMETRY type.

- V
0 Kudos
gismoe
by
Frequent Contributor
Can you elaborate on this?

I found this example:

CREATE TABLE SpatialTable
    ( id int IDENTITY (1,1),
    GeomCol1 geometry,
    GeomCol2 AS GeomCol1.STAsText() );
GO


INSERT INTO SpatialTable (GeomCol1)
VALUES (geometry::STGeomFromText('point ((100 100))', 0));
GO

But how can ArcGIS display that?
0 Kudos
VinceAngelo
Esri Esteemed Contributor
Look at the documentation for registering a layer with ArcSDE, or if you're
using ArcGIS 10, for query layers.

- V
0 Kudos
gismoe
by
Frequent Contributor
Registering a layer works pretty good but how can i display a table with a GEOMETRY type?
0 Kudos
VinceAngelo
Esri Esteemed Contributor
When you register a *layer* (not table) with ArcSDE, an entry is made in the
LAYERS table for that GEOMETRY column, making it availbale to ArcGIS for
geodatabase participation.  Query layers view GEOMETRY columns without
registration.

- V
0 Kudos
gismoe
by
Frequent Contributor
Thank you very much. It works!
Sorry but i'am a rookie with this tools and SQL Server an it took a while from "register a *layer*" to sdelayer -register .....
0 Kudos