cancel
Showing results for 
Search instead for 
Did you mean: 

Drop Temporary Table

Former Member
0 Kudos

Hi

I'm doing an aplication with the SAP Business One SDK but

i don't now if i can use objects of Sql to remove a Temporary Table

The Code that I try use is...............

             oConexionSQL = New SqlConnection(sCadenaConexion)

                    oComandoSQL = New SqlCommand

                    oComandoSQL.Connection = oConexionSQL

             sQuery = "if not OBJECT_ID('" & sNombre_Tabla & "') is null DROP TABLE " & sNombre_Tabla

                    oComandoSQL.CommandText = sQuery

                    oComandoSQL.ExecuteNonQuery()

                    oConexionSQL.Close()

Someone can answer me

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Dear ,

give a try to your query as well if that doesn't work the following will surely do..

 

oRecSet.DoQuery("SELECT * FROM SYSOBJECTS WHERE NAME = 'sNombre_Tabla'");

if (oRecSet.RecordCount > 0)

{

   sqlQuery = "Drop table sNombre_Tabla "

   oComandoSQL.CommandText = sQuery

   oComandoSQL.ExecuteNonQuery()

}

Regards

Former Member
0 Kudos

Hi Rafael,

     SAP has a built in sql connection. You can use the DI API. For you to able to create a query, you should declare like this.

Dim oCompany As SAPbobsCOM.Company

Dim oRec As SASPbobsCOM.Recordset

Dim oQuery As String

oCompany = SBO_Application.Company.GetDICompany

oRec = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

oQuery = ""

oRec.DoQuery(oQuery)

Regards,

Former Member
0 Kudos

Thanks Bryan for your answer but

i don't want to do only a Query.

i want to do with the SQL objects is Create and Remove a Temporary Table

I don't now if you can help me