Link to home
Start Free TrialLog in
Avatar of dshi15
dshi15Flag for United States of America

asked on

Invalid operator for data type. Operator equals boolean AND, type equals varchar.

ALTER Procedure [dbo].[sp_ProcessImage]

      @Err int OUTPUT
      
As
declare @rowPro integer      -- 1 row must be Updated

select @Err = 1
      
Begin Tran

INSERT INTO Asset
( ............


It has error in line

select @Err = 1

said
Invalid operator for data type. Operator equals boolean AND, type equals varchar.

Why?

thanks.
Avatar of Aneesh
Aneesh
Flag of Canada image

can u post the complete query
I believe that the actual error is on the previous line. There is no "integer" data type in SQL Server. Change the line to:

declare @rowPro int
Avatar of dshi15

ASKER

ALTER Procedure [dbo].[sp_maint_ProcessImageLibrary]
      
      @Err int OUTPUT
      
As
declare @rowPro integer      -- 1 row must be Updated

                                                
select @Err = 1      
Begin Tran

INSERT INTO Asset
(
AssetId,
DownloadPath,
PreviewPath,
FSPath,
ToDate,
AssetDesc,
AssetType,
DownloadFile,
PreviewFile,
FSFile,
GraphicColor,
AllPromos,
AllTG,
AllBrands,
Status,
FromDate,
SystemDate,
UID
)
SELECT 'test_' & [OfferGraphics].[AssetName] AS Expr1,
'https://DOCUMENTS.com/W/' & 'TakeLoadOff' & '/' AS Expr2,
'https://DOCUMENTS.com/W/' & 'TakeLoadOff' & '/Thumbnail/' AS Expr3,
'https://DOCUMENTS.com/W/' & 'TakeLoadOff' & '/Large/' AS Expr4,
'9/15/2007',
OfferGraphics.[AssetDescription],
6,
OfferGraphics.[DownloadFileName],
OfferGraphics.[PreviewFilename],
OfferGraphics.[FSFileName],
OfferGraphics.[BW/Color],
'N',
'N',
'N',
'A',
getdate(),
getdate(),
'011sh'
FROM OfferGraphics

      select @rowPro = @@rowcount
      
if @rowPro <> 1 or @@error != 0
      begin
            Rollback Tran
            select @Err = 1
            return
      end
Commit Tran
      select @Err = 0      
      return
Avatar of dshi15

ASKER

I used declare @rowPro integer      in other store procedures,  it is fine, never has error.
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dshi15

ASKER

thank you very much.
TSQL is not VB.  No *integer* data  type nor *&* operator.  Use *int* and *+* instead...
I suppose that "integer" is some not very well documented alias for "int". You should stick with the normal names for the data types, the ones that everyone else are using.

Also, the != operator is non-standard. You should use the <> operator instead.