Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GMW_NewRecID function in the xp_GMNewRecid extended stored procedure

Status
Not open for further replies.

whateveremail22

Programmer
Apr 13, 2004
3
0
0
CA
Hi,

I need to create an entry in the MSSQL lookup table using the stored procedures. Since there is no proc for managing the lookup table, I thought I would insert the record into the table directly and then use the GMW_UpdateSyncLog to maintain sync'ing.

Unfortunately, the documentation for the GMW_UpdateSyncLog requires that I pass in a recid for the entry inserted. The only way to get this recid is to use the extended stored procedure in your Master database called xp_GMNewRecid. That has function called GMW_NewRecID.

Does anyone have any code/knowledge of how to use the extended proc?

Thank you for your help.

Paul.
 
Hi Paul

I have used Delphi 5 to insert records into Lookup. I'll post how I did it and maybe it will help....

First I created a stored procedure in the database I was using, this would be in whatever SQL database that LOOKUP is in, got to stored procedures in Enterprise Manager, create new, then...

CREATE PROCEDURE [sp_GMW_NewRecID] AS
DECLARE @answer varchar(15)
EXEC master.dbo.XP_GMNewRecid 'sa', @answer OUTPUT
select @answer as RecId

The rest depends if you are doing this from query analyzer or an interface.

In my interface (Delphi app), used a query component and called the stored procedure from the SQL string property. ( So place sp_GMW_NewRecID as the SQL string that will be called.

After that, you can store your stored procedure results to a variable. An example of my code....

Qry_recid.Close;
Qry_recid.Open;
s_recid:=Qry_recid.FieldByName('Recid').AsString;
Query1.SQL.Clear;
Query1.SQL.Add('insert into lookup values( :fieldname, :lookupsupp, :entry, :u_entry, :recid)');
Query1.ParamByName('entry').AsString:=trim(Edit1.Text);
Query1.ParamByName('u_entry').AsString:=trim(uppercase(Edit1.Text));
Query1.ParamByName('fieldname').AsString:='USOURCE1 V';
Query1.ParamByName('lookupsupp').AsString:=trim('');
Query1.ParamByName('recid').AsString:=s_recid;
Query1.ExecSQL;
Query1.Close;

You should be able to do something along the same lines with Query Analyzer.

this should get you started, post again if there are questions or if you find something new

Good Luck
Dave
 
Hi Dave,

Thanks for the perfect example. It sure did help. I did not have the sp_GMW_NewRecID procedure and now everything works perfectly. Thank you.

Paul.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top