Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Wednesday, May 15, 2024 
 
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: Auto-Increment ID Fields...
Don Barr
Posts: 4
 
Auto-Increment ID Fields...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Feb 07 12:26 PM
fiogf49gjkf0d
Hi folks,

I'm trying to use the auto-increment feature (we have slx 6.2.3) on a custom table I created, but slx isn't cooperating.

Quick backround:
custom table - contact_commissions, joined 1:many to contact on contactid. Simple. One key field, contact_commissionsid was created, and I have checked the auto-increment box on this field in database manage. I checked sectabledefs, and autoincrement is marked T for this field. Everything looks good to me.

So I fire up administrator, go to sql and try:
insert into contact_commissions (contactid, field1, field2, field3)
select contactid, field1, field2, field3 from where

and promptly get the "Cannot insert the value NULL into column contact_commissionsid TABLE: nha_slx.sysdba.contact_commissions. Column does not accept nulls" error.

What am I doing wrong? contact_commissions is the key field, I'm executing the sql from inside the slx administrator, and I know the field is set to auto-increment. Shouldn't slx be creating the contact_commissionsid field values for this table as the records insert?

Any clues appreciated.

Don
[Reply][Quote]
Ron Buchanan
Posts: 72
 
Re: Auto-Increment ID Fields...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Mar 07 9:53 PM
fiogf49gjkf0d
Don,
You've got to use the application functions to get the ID for the record.
Application.BasicFunctions.GetIDFor("Contact_Commission")

From SQL, you're not specifying a value for the CONTACT_COMMISIONID, so you're getting the NULL insert error.

HTH,
Ron
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Auto-Increment ID Fields...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Mar 07 11:35 AM
fiogf49gjkf0d
Have you checked the sectabledefs.autoincrement to see if the field does in fact show it is marked for autoincrement?

This works for me and your steps you outline doesn't seem like anything is missing.
[Reply][Quote]
Lana
Posts: 10
 
Re: Auto-Increment ID Fields...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Jun 07 3:32 PM
Hello,
I have the same issue: the field is checked as autoincrement and the sectabledefs.autoincrement = 'T'
My table was originally designed as not having the table id column being auto incremented.
Now we need to do bulk inserts into the table and I've modified field's property.
Insert is failing because of the null values in the table id column.

Thanks,
Lana
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Auto-Increment ID Fields...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Jun 07 3:35 PM
You want to ensure that you're *not* inserting NULL values into the ID field. It should be omitted completely from the insert statement or you'll get the error you mention.

For example, do this:

insert into mytable (field1, field2) values ('Value 1', 'Value 2')


Do not do this:

insert into mytable (mytableid, field1, field2) values (null, 'Value 1', 'Value 2')


Does that make sense?
[Reply][Quote]
Lana
Posts: 10
 
Re: Auto-Increment ID Fields...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Jun 07 3:44 PM
Ryan,
Thanks! I did exclude the tableid from my statement. By the way, I am using SLX 7.0.1 and SQL Server 2005 as our host db.
Could my errors refer to the fact that originally my table was not defined as having auto-increment fields?

Thanks!
Lana
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: Auto-Increment ID Fields...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Jun 07 6:31 AM
If you "fix it" so that autoinc is "on" you have to restart the provider.
--
rjl
[Reply][Quote]
Lana
Posts: 10
 
Re: Auto-Increment ID Fields...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Jun 07 10:16 AM
I did restart SLXSystem to no effect. I also tried to clear all data from the table before running an insert but this didn't help either. So, I guess I'll try to trick SLX by finding a way to insert unique values and to generate ID column.
I don't actually need this column in my custom table. Is there a way to get rid of it?

Thanks!
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: Auto-Increment ID Fields...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Jun 07 1:29 PM
I recall having to reboot the SLX Server machine. I may have overlooked a service or something, but the reboot worked just fine too

Timmus
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: Auto-Increment ID Fields...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Jun 07 6:44 AM
Correct.. too many folks think that rebooting their client system is the answer.. it's the Slx Server that needs to be re-booted.
--
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 © 2024 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): 5/15/2024 2:27:57 PM