CREATE VIEW [dbo].[SMS_Prefixes]
AS
SELECT dm.AutoId AS Id,
       CAST(sms.ServiceId AS NVARCHAR(10)) AS PrefixText,
       sms.SQLCommandText,
       REPLACE(REPLACE(dm.message, '[', '{'), ']', '}') AS ExistRowText,
       'کد عضويت شما تعريف نشده است ' AS NotExistRowText
FROM dbo.SMS_AutoSendingSettings AS sms
    INNER JOIN dbo.TblDefineMessage AS dm
        ON dm.AutoId = sms.DefinedSmsId
WHERE (sms.IsActive = 1);