Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Wednesday, February 19, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Data & Imports Forums - T-SQL & Queries
Forum to discuss general T-SQL questions and help with queries related to SalesLogix data. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to T-SQL & Queries | New ThreadView:  Search:  
 Author  Thread: Store proc
subash shrestha
Posts: 5
 
Store procYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jul 07 3:52 PM
I am very new to SalesLogix. I heard that we can store proc in SalesLogix but i am still not able to figure out hot to do it. I would really appreciate if you can write some basic steps that we should follow to call store proc?
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Store procYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jul 07 4:16 PM
That's not the intended way for SLX to work. All data access in SLX is to be done via the SLX OLEDB provider. This way it will all synchronize to remotes and SLX security can be enforced. Using a stored proc bypasses this.
[Reply][Quote]
Eric Hobbs
Posts: 28
 
Re: Store procYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Jul 07 3:04 AM
Subash,

As Ryan pointed out, using stored procedures will bypass the OLE DB Provider and the changes to the database will not be sent out to remotes. Also, you break the SLX security model when passing SQL commands outside of the OLE DB provider. However, it is possible to use a stored procedure, but you need to understand that doing so could have negative implications. In addition, I have found that any stored proceudre in which you pass paramaters to, will not work properly. To call a stored procedure from a web client script use the following in your Action code:

strSQL = "execute sp_procedurename"
x = DBOpenSQL(strSQL, False)

I beleive that syntax is similar for the LAN client?

If you are trying to run a complex query and want to use the stored proc for performance reasons, this should work fine. If you are trying to run procs that alter data, however you can run into lots of issues such as the ones mentioned above. Also SLX generates it's SQL dynamicly, so this can cause problems when trying to run a stored proceudre in this way. I believe that's whay procs that expect paramaters do not work properly.
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: Store procYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Jul 07 7:02 AM
Right on Eric.

Based on the issues you point out (especially security and the fact that SP's have no concept of handling GMT based datetime)... SP's are something to totally avoid.

SP's never have been nor do I ever expect them to be in the SalesLogix "model" of doing things.

Note: Every time I've seen questions about SP's it seems to come from the "dba" world rather than the "application programme/developer" side. SalesLogix treats the db as a "data store" and nothing else. It's a "top down" thing... not "bottom up".

--
rjl
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Store procYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Jul 07 6:41 PM
Executing a stored proc in the LAN client is simple to initiate - eg (assuming a connection object objCon has been created):

strSql = "EXEC [procname]"
objCon.Execute(strSql)

It is something that I have done in the past (and yes, I do have a SQL Server background ) It's a very fast way of performing data processing on the server - if you architect it right. An example might be for a data import process, where the data is imported into 'staging' tables that are NOT sync'd to remotes.

Here's the process:
Import data
Run the stored proc to process the imported data in the non-sync staging tables
Use standard SLX iterative looping, via the provider, to load the data into 'standard' SLX tables that will sync out.

In line with the advice given above, do not go down this path unless you understand the implications of bypassing SLX OLEDB Provider synchronisation.

[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: Store procYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 12 Jul 07 6:47 AM
Yep, know exactly what you are talking about.

Your warning/disclaimer is very appropriate.


I would suggest you put a "test" in your code to make sure you are executing on the main db and not remote:

If NOT OnMainDb Then
'do NOT execute this
Exit.....
End If


Function OnMainDb()
If GetSsalarValue("SELECT DBTYPE FROM SYSTEMINFO WHERE SYSTEMINFOID = 'PRIMARY') = 1 Then
OnMainDb = True
Else
OnMainDb = False
End If
End Function

Function GetScalarValue(sql)
Dim rs

Set rs = CreateObject("ADODB.Recordset")
rs.Open sql, Application.GetNewConnection

If Not (rs.EOF Or rs.BOF) Then
GetScalarValue = rs(0).Value & ""
Else
GetScalarValue = ""
End If
rs.Close
Set rs = Nothing
End Function
Function OnMainDb()


.. something like that.. above..
--
rjl
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 2/19/2025 4:39:45 PM