on 07-19-2018 7:58 AM
Hi to all
IF @object_type = '2' and @transaction_type in ('A','U')
BEGIN
if Exists(
SELECT DISTINCT 'TRUE' FROM OCRD T0 INNER JOIN CRD1 T1 ON T0.[CardCode] = T1.[CardCode] WHERE T1.[State] ='AP' AND T1.[GSTRegnNo]LIkE '37_%_%_%_%_%_%_%_%_%_%_%_%_%')
BEGIN
Select @error = -1,
@error_message = 'Plase Enter Correct GST No based State'
End
End
----My Requiremnet is
where State: Ap then GSTREGno Start with 37
and
where State: TG then GSTREGno Start with 36
Thanks for Advance help
Hi there,
Please, try the following
IF @object_type = '2' and @transaction_type in ('A','U')
BEGIN
SELECT TOP 1 @error = '1', @error_message = 'Plase Enter Correct GST No based State'
FROM CRD1
WHERE CRD1.CardCode = @list_of_cols_val_tab_del -- Or @list_of_key_cols_tab_del, I always mix them up(
AND (
(CRD1.[State] ='AP' AND CRD1.[GSTRegnNo] NOT LIKE '37%')
OR
(CRD1.[State] ='TG ' AND CRD1.[GSTRegnNo] NOT LIKE '36%')
)
END
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Thanks for Quick replay
i want my Requirement like as follow
based on the above requirement, i want the function
You can play with this pattern, but the idea is that you can use SQL Server like wildcards. The parttern below shows: 36 + 5 letters in specified range + 4 digits + 4 mixed letters and digits. Adapt it for your needs if I misunderstood.
IF @object_type = '2' and @transaction_type in ('A','U')
BEGIN
SELECT TOP 1 @error = '1', @error_message = 'Plase Enter Correct GST No based State'
FROM CRD1
WHERE CRD1.CardCode = @list_of_cols_val_tab_del
AND (
(CRD1.[State] ='AP' AND CRD1.[GSTRegnNo] NOT LIKE '37[ACHGFLPT][ACHGFLPT][ACHGFLPT][ACHGFLPT][ACHGFLPT][0-9][0-9][0-9][0-9][A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]')
OR
(CRD1.[State] ='TG ' AND CRD1.[GSTRegnNo] NOT LIKE '36[ACHGFLPT][ACHGFLPT][ACHGFLPT][ACHGFLPT][ACHGFLPT][0-9][0-9][0-9][0-9][A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]')
)
END
<br>
THE above pattern is not working...
4th letter contains A (or) C (or) F (or) G (or) H (or) L (or) P (or) T )
could you suggest me ...
i tried like this THEN ALSO NOT WORKING
(CRD1.[State] ='AP' AND CRD1.[GSTRegnNo] NOT LIKE '37[A-z][A-Z][A-Z][ACHGFLPT][A-Z][0-9][0-9][0-9][0-9][A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]')
WHATS WRONG THIS CODE
HERE I FOCUSED
BBCCK (HERE 4th letter contains A (or) C (or) F (or) G (or) H (or) L (or) P (or) T )) ONLY
User | Count |
---|---|
100 | |
11 | |
10 | |
6 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.