Link to home
Start Free TrialLog in
Avatar of omkaar4
omkaar4

asked on

Datatype Conversions

The below query is causing too much wait time.

(@P0 bigint,@P1 bigint,@P2 bigint,@P3 bigint,@P4 varchar(4000))
select * from USER_TRACKED_EVENT where (USER_TRACKED_ID= @P0  AND USER_EVENT_TYPE_ID= @P1 )
OR (USER_TRACKED_ID= @P2  AND USER_EVENT_TYPE_ID= @P3  AND VALUE1= @P4 )

In case of Datatype mismatch, is it best option to convert @p4 or should we convert "VALUE1" column in USER_TRACKED_EVENT  table .
The datatype of "VALUE1"  is varchar (32).


I think it is best to convert the temporary variable @p4 but i dont want to miss any data, as if the data exceeds varchar(32) , the remaining will be trimmed.
But if we convert "value1" o varchar(8000), then it will utilize memory.
Please give some suggestion
SOLUTION
Avatar of jogos
jogos
Flag of Belgium 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
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
SOLUTION
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
SOLUTION
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
ASKER CERTIFIED SOLUTION
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