Skip to Content
1
Former Member
Jun 21, 2012 at 08:53 AM

SQL Query for automatic creation of Item Code

265 Views

Hi - A contact of mine is asking this question about SQL Query which is out of my knowledge. Please can anyone help?

Hi,thanks for the help,i've one more problem.i have made a query for automatically creation of item code in item name field but it didn't work.can u help me that it is right or wrong.query that i've made is below.

SELECT substring ((MAX(T0.ItemCode)), 0,4)cast ((Substring ((MAX(T0.ItemCode)),4,4)1) AS varchar(20))

FROM OITM T0

WHERET0.ItmsGrpCod = $[OITM.ItmsGrpCod]

whenever i execute this query i get an error like this:- 1). [SQL Native Client][SQL Server]Incorrect syntax near the keyword 'SELECT'. 2). [SQL Native Client][SQL Server]Incorrect syntax near 'OITM.ItmsGrpCod'. 3). [SQL Native Client][SQL Server]Statement 'Service Contracts' (OCTR) (s) could not be prepared.so how could i genrate item code automatically and what is the solution of above error,plz tell me asap.i'll wait for ur reply