Identity Column - MS SQL Server 6.5 & PB 5.0

Using PB 5.0 and MS SQL 6.5

After an embeded Insert Statement, I use the following to get the value
assigned by the Identity column :


INT emp_id
DECLARE get_value DYNAMIC CURSOR FOR SQLSA ;
PREPARE SQLSA FROM "SELECT @@identity";
OPEN DYNAMIC get_value ;
FETCH get_value INTO :emp_id ;
CLOSE get_value;


The emp_id returned seems to always be NULL. It is supposed to be the
last (autoincrement) number assigned to the record inserted into the
Employees table.

Does anyone know why I am getting a NULL instead of a real value? The
column is defined as an Identity in the table. There are no Insert
Triggers
on the Employees table.

Thanks

0
Eli
6/4/1998 7:15:17 PM
sybase.powerbuilder.database 9855 articles. 2 followers. Follow

2 Replies
804 Views

Similar Articles

[PageSpeed] 20
Get it on Google Play
Get it on Apple App Store

try:

long ll_id

select @@identity
into :ll_id
from systypes
where name = 'int'

Your code doesn't work because PB generate a cursor in SQL Server. When PB
send the first prepare statment to generate a cursor the value of @@identity
is loose...

Using a static SQL You can read a real @@identity value. But PB doesn`t
permit a SELECT withou a FROM clause (this is a reason of "from systypes").

Eli A. Sbaity escreveu na mensagem <3576F244.94F74D4@byteware-intl.com>...
>Using PB 5.0 and MS SQL 6.5
>
>After an embeded Insert Statement, I use the following to get the value
>assigned by the Identity column :
>
>
>INT emp_id
>DECLARE get_value DYNAMIC CURSOR FOR SQLSA ;
>PREPARE SQLSA FROM "SELECT @@identity";
>OPEN DYNAMIC get_value ;
>FETCH get_value INTO :emp_id ;
>CLOSE get_value;
>
>
>The emp_id returned seems to always be NULL. It is supposed to be the
>last (autoincrement) number assigned to the record inserted into the
>Employees table.
>
>Does anyone know why I am getting a NULL instead of a real value? The
>column is defined as an Identity in the table. There are no Insert
>Triggers
>on the Employees table.
>
>Thanks
>


0
Regis
6/21/1998 6:05:01 PM
Hi !
And why you do not use simple store procedure :
:SQL
CREATE PROCEDURE GetID AS SELECT @@identity
: PB ( create a global function gf_getid)
Long ll_id
DECLARE GetID Procedure for GetID ;
EXECUTE GetID ;
FETCH GetID INTO :ll_id ;
Close GetID ;
RETURN ll_id
0
syscom
6/28/1998 9:26:51 AM
Reply:

Similar Artilces:

Powerbuilder 6.5 & SQL-server 6.5 <> 7.0
Hi everyone, I'm using PB 6.5 with SQS 6.5 Everything is normal until I port the program build in this environment to a similar environment with the only difference that the database is SQS 7.0 This database is slightly different - in some tables, the fields are larger than in the SQS 6.5 database (but the same type - char). When the program retrieves rows in that environment I get the error message 'Data conversion resulted in overflow ...' I have several other environments with sqs 6.5 with the same difference (larger fields) where the program doesn't rep...

pb 5.0 with sql server 6.5
hi, i am using ODBC to connect my PB5 application to MS Sql 6.5. I found that following error will occur if i want to retrieve a table which contain a text field from a datawindows "String Data, right truncation" error. How can i solve this? thanks! james ...

Connection of PB 6.0 to SQL Server 7.0 & Version B/W PB 6.0 and PB 7.0
Can anyone tell me about connecting PB 6.0 to SQL Server 7.0. Please remember we are not planning to upgrade both software. When I was trying to connect PB 6.0 to SQL Server 7.0, error occurred " SQLSTAT 1003". OS=NT 4.0 Server PB=6.0 Enterprise Edition SQL SERVER=7.0 Corporate Edition I also want to know the versions between PB 6.0 to PB 7.0 If your are using the ODBC, which I assume you are, include Disablebind=1 in your DBParm. If your deployment environment is also NT, you will have to turn SQLSPY=1 using PFC services. Autocommit=FALSE and SetTransObject() ra...

Help me about connecting PB 6.0 to SQL Server 7.0 & Versions B/W PB 6.0 and PB 7.0
Can anyone tell me about connecting PB 6.0 to SQL Server 7.0. Please remember we are not planning to upgrade both software. When I was trying to connect PB 6.0 to SQL Server 7.0, error occurred " SQLSTAT 1003". OS=NT 4.0 Server PB=6.0 Enterprise Edition SQL SERVER=7.0 Corporate Edition I also want to know the versions between PB 6.0 to PB 7.0 I don't believe this is going to be possible without at least upgrading to the latest maintenance release of 6.x. On Mon, 23 Aug 1999 00:59:56 -0700, in powersoft.public.powerbuilder.database Abdul Lateef <abdul_lat...

Microsoft SQL Server 6.x (PB 6.5) VS ODBC (PB 10.5) ...
Hi everybody, After migrating my application from PB 6.5 which uses Microsoft SQL Server 6.x as a DB connection and having to set up ODBC for PB 10.5 I am getting the following error: "SQLSTATE = 22005, Invalid character value for cast specification" This happen for absolutely every single dw that is created based on an Store Procedure. What could be happening? How can I fix this? Thank you, Gabriela ...

PowerBuilder 5.0.03 & SQL Server 7.0 & ODBC
Hi All, I have a peculiar problem while connecting to SQL Server 7.0 From PowerBuilder 5.0.03 Enterprise through ODBC. I can connect from a windows 95 machine (where my client is) to a Windows NT4 (SP3) machine (where the server resides) via ODBC. I use the dll's provided by PowerBuilder. (PBODB050.dll, PBODB050.ini). Till this it is fine. The problem comes when my client is also in the NT Server (where the database resides). I can connect to SQL Server 7.0 from PowerBuilder 5.0.03 on windows NT4.0 but all the select statements which has Varchar type columns in it, returns null...

PowerBuilder 5.0.03 & SQL Server 7.0 & ODBC
Hi All, I have a peculiar problem while connecting to SQL Server 7.0 From PowerBuilder 5.0.03 Enterprise through ODBC. I can connect from a windows 95 machine (where my client is) to a Windows NT4 (SP3) machine (where the server resides) via ODBC. I use the dll's provided by PowerBuilder. (PBODB050.dll, PBODB050.ini). Till this it is fine. The problem comes when my client is also in the NT Server (where the database resides). I can connect to SQL Server 7.0 from PowerBuilder 5.0.03 on windows NT4.0 but all the select statements which has Varchar type columns in it, returns null...

PB 5.0.03 and SQL Server 6.5 with WinNT Integrated security
I�ve followed every step in configuring SQL Server to use Windows NT Server integrated security; from PB, I�ve modified de SQLCA�s properties by setting DBParm= "Secure = 1", but it still doesn�t work. (I�m using native drivers) Could anybody help me? ...

PB 7.0 & SQL SERVER 6.5
How does one configure PB 7.0 to read a SQL SERVER 6.5 database? PB is running on a Window 95 workstation. If you are using the Enterprise version, you just use the MSS driver. On Thu, 13 Jan 2000 19:35:14 -0500, in powersoft.public.powerbuilder.database Melchior Gracias <mgracias@gis.net> wrote: >How does one configure PB 7.0 to read a SQL SERVER 6.5 database? >PB is running on a Window 95 workstation. > > --- Bruce Armstrong [TeamSybase] | mailto:Bruce.Armstrong@teamsybase.com Watch for the KFORCE ad in the SuperBowl! | http://www.kforce...

Cannot use SQl Sample Database 5.0 after updating to 6.5 PB... pls help
Please help. What is going on ? This is the errors DBENG50 caused an invalid page fault in module KERNEL32.DLL at 0177:bff9d709. Registers: EAX=c00300ec CS=0177 EIP=bff9d709 EFLGS=00010216 EBX=00000005 SS=017f ESP=0060feb4 EBP=00610150 ECX=00000000 DS=017f ESI=00610238 FS=4ee7 EDX=00000028 ES=017f EDI=00610254 GS=0000 Bytes at CS:EIP: 53 8b 15 dc 9c fc bf 56 89 4d e4 57 89 4d dc 89 Stack dump: Is it possible that the 5.0 database was upgraded? I'm just thinking out loud here.... I can't think of a reason that the PB 6.5 upgrade would cause the SQL Anywhere db engi...

migrating from pb 5.0 -> pb 6.0/6.5 any pothole
I am looking for any know potholes to avoid in migrating several PB 5.0 application to PB 6.0/6.5 using an Oracle 7.3 data base on Win 95 client? Thanks Brian, Take a look at http://techinfo.sybase.com/css/techinfo.nsf/DocID/ID=47787 Also, do your own search on 'mirgrating' and you should come up with a few other references. Frank Brian Scanlon wrote in message <01be37fa$0aa527a0$4e4b8282@bscanlon.cdphp.com>... >I am looking for any know potholes to avoid in migrating several PB 5.0 >application to PB 6.0/6.5 >using an Oracle 7.3 data base on Win ...

PB 6.0/SQL Server 6.5/NT 4.0 using TCP/IP
I'm trying to connect a client to MS SQL Server 6.5 on NT4.0 over TCP/IP and am running into a strange situation that I hope someone can help me with. If I connect to the server in another domain and go out and see the server, PB will connect without a problem. If I'm not connected to the server, PB can't make the connection and will time out. Is there any way you can make the connection without having to have the OS level connection? Can anyone also give an area in the manual to look for how the connection is done to TCP/IP? I looked in Connecting To Your Database and...

Problem with PB 6.0, SQL Server 6.5, Driver ODBC Intersolv 3.0
I have a strange problem using Driver ODBC Intersolv 3.0 for SQL Server 6.5; when I work with PB 6.0 and I use the Database painter, PB open two connections to the database. Into the first connection the statements are: use <Dbname> SET ANSI_NULL_DFTL_ON ON exec Sp_SeRvEr_InFo exec sp_server_info exec sp_datatype_info 0 In the second connection, PB execute the statement required by the painter. In the first connection no other requests appair and the connection seems 'suspended' until I close PB. This behavior is replicate when I run the application from PB ...

Second posting for problem with PB 6.0, SQL Server 6.5, Driver ODBC Intersolv 3.0
I have a strange problem using Driver ODBC Intersolv 3.0 for SQL Server 6.5; when I work with PB 6.0 and I use the Database painter, PB open two connections to the database. Into the first connection the statements are: use <Dbname> SET ANSI_NULL_DFTL_ON ON exec Sp_SeRvEr_InFo exec sp_server_info exec sp_datatype_info 0 In the second connection, PB execute the statement required by the painter. In the first connection no other requests appair and the connection seems 'suspended' until I close PB. This behavior is replicate when I run the application from PB (I...

Error connecting Pb 6.5 and Pb 7.0 to SQL SERVER 7.0 desktop(Window 98)
Today(9 Sep 1999), I can't connect to SQL Server 7.0 before this i can connect it. It give an Error "Unable to connect : SQL Server is unavailable or does not exist, Specified SQl Server not found ". I have check with Query analyzer , the Query analyzer can connect very well. Any one this have this problem, and how to solve this ??? TIA -- Regards Daniel Fransius not enough information... are you trying to use OLE DB ? ODBC ? Native driver ? What about security settings on the server ? What user id and password are you passing ? There is a lot of things ...

Web resources about - Identity Column - MS SQL Server 6.5 & PB 5.0 - sybase.powerbuilder.database

Identity of the first male Muslim - Wikipedia, the free encyclopedia
There is some disagreement among Muslims , and among historians of Islam , as to the identity of the first male convert to Islam after Muhammad ...

'It's time for Aboriginal identity and story to be embraced by all Australians'
Some places in Perth were named after governors or other European elites, wives and family members or places in Britain. Frankly, many names ...

Case of mistaken identity: No, Iyad El-Baghdadi is not the leader of Daesh
Case of mistaken identity: No, Iyad El-Baghdadi is not the leader of Daesh

AOL's identity crisis: The company may ditch the 'AOL' brand
... with a bunch of different subsidiaries within it . AOL already has the different companies within it, it just needs to figure out the identity ...

Internal police records point to the identity of the officer who fatally shot Bettie Jones and Quintonio ...
The mother of five and the distraught teenager were shot and killed by police officer Robert Rialmo, according to a Reader analysis of internal ...

Lucasfilm Confirms Star Wars: The Force Awakens Stormtrooper TR-8R's Identity
Lucasfilm teased that despite the shot from Chewbacca's almost impossibly powerful bowcaster [...]

Elite Chicago HS Plans Seminars On ‘Racial Identity’ For MLK Day
Topics include 'Western Bias in Science' and 'Whitewashing in Cinema'

'The Flash' Season 2 Spoilers: Will Barry Reveal His Secret identity To Patty In Episode 10?
... (Shantel VanSanten) that he's the Scarlett Speedster. Patty (Shantel VanSanten) may finally find out Barry's (Grant Gustin) superhero identity ...

Centrify Updates Privileged Identity Management Platform
The solution is designed for an enterprise’s hybrid IT environment of cloud, mobile and on-premises and leverages the Centrify Identity Platform. ...

Another State Puts Brakes On Tax Refunds, Citing Concerns About Identity Theft
North Dakota has announced that it will slow the issuance of tax refunds this season in an effort to try and stop identity theft-related tax ...

Resources last updated: 1/20/2016 3:59:16 AM