Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
tariq2
Posting Yak Master
125 Posts |
Posted - 2011-10-03 : 14:36:29
|
| Hi,Below,the first query takes varchar but the second takes char.How do I overcome this? Thank you in advanceDECLARE @JOBID char(12)set @JOBID = '1005644901'select * from Audit_JobSS where JobKey in (select JobKey from D_JobAttributes where JobID = @JOBID)and LedgerKey = '20'select SUM(TOTALAMOUNT) from F0902 where GBMCU = @JOBIDand AccountKey in (select AccountKey from D_Accounts where L1Description = 'Revenue')and GBLT = 'HA' |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-03 : 14:44:15
|
| what are datatypes of JobID and GBMCU ?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
tariq2
Posting Yak Master
125 Posts |
Posted - 2011-10-03 : 15:07:51
|
| JobID is varchar(12) so can take '1005644901'.However gbmcu is chat(12) and takes ' 1005644901' |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-03 : 15:12:28
|
| cast it to varchar and then do check------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|