|
Prev: How to optimize "Inserted Scan" in trigger code
Next: Producing data from querying three tables
From: Raman on 4 Jul 2008 11:56 The query is working fine I tested in SQL Server Express 2005. My Database name is master and table name is TEST The query I tried both the queries SELECT MAX(CONVERT(INT, SUBSTRING(INTEGRATION_ID, 3, 10))) AS TEST FROM Test WHERE (LEFT(INTEGRATION_ID, 2) = 'SR') AND (X_CREATE_SOURCE = 'Sales') It return 83 to me because I took 3 enteries as sample. Sales SR0000000082 Sales SR0000000083 Sales 5600000.00084 Second query returns me 82 and 83 Query was :- SELECT CONVERT(INT, SUBSTRING(INTEGRATION_ID, 3, 10)) AS Expr1 FROM Test WHERE (LEFT(INTEGRATION_ID, 2) = 'SR') AND (X_CREATE_SOURCE = 'Sales') As per the design my table TEST contains the field as:- INTEGRATION_ID nvarchar(30) X_CREATE_SOURCE varchar(20) Better you use nvarchar instead of varchar for INTEGRATION_ID. So If needs any clarrification feel free to write
|
Pages: 1 Prev: How to optimize "Inserted Scan" in trigger code Next: Producing data from querying three tables |