AnsweredAssumed Answered

Execute Sql Statement in SQL Server 2008 with ArcSDE connection

Question asked by topo_geo on Jul 29, 2013
Latest reply on Aug 1, 2013 by rzufelt
i'm trying to execute this SqlStatement to establish an sql query in sql server 2008 with an arcsde connection (arcsde personel use)

but there is no result.

the sql statement is :

Execute SQL Statement: (SELECT * FROM [TOP10_SIG].[dbo].[ABCBNIVL] WHERE [TOP10_SIG].[dbo].[ABCBNIVL].[TYPECBN] = 3)

an idea please !
I use ArcGIS 10.0
Arcsde personal use


import arcpy from arcpy import env import sys import os arcpy.env.workspace = (r"c:\connectionFiles\conntop10sig.sde") try:     SQLStatement = "SELECT * FROM [TOP10_SIG].[dbo].[ABCBNIVL] WHERE [TOP10_SIG].[dbo].[ABCBNIVL].[TYPECBN] = 3 "     SQLStatementList = SQLStatement.split(";")     print "\n"     for sql in SQLStatementList:         print "Execute SQL Statement: " + sql         try:             sdeReturn = sdeConn.execute(sql)         except Exception, ErrorDesc:             print "ErrorDesc"             sdeReturn = False         if isinstance(sdeReturn, list):             print "Number of rows returned by query: " + len(sdeReturn), "rows"             for row in sdeReturn:                 print "row"                 print "\n"             else:                 if sdeReturn == True:                     print "SQL statement: " + sql + " ran sucessfully."                     print "\n"                 else:                     print "SQL statement: " + sql + " FAILED."                     print "\n" except Exception, ErrorDesc:     print "Exception, ErrorDesc" except:     print "Problem executing SQL.