Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6824531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:54:45+00:00 2026-05-26T21:54:45+00:00

TBL COL NAME DATATYPE ALLOW NULL Subscriber_ID int Unchecked Subscriber_Initial varchar(5) Unchecked Subscriber_Name varchar(50)

  • 0
TBL COL NAME                DATATYPE        ALLOW NULL

Subscriber_ID               int         Unchecked
Subscriber_Initial          varchar(5)  Unchecked
Subscriber_Name             varchar(50) Unchecked
Subscriber_Email            varchar(50) Unchecked
Subscriber_Group            varchar(20) Unchecked
Subscriber_Date             datetime    Unchecked
Subscriver_Active           bit         Unchecked
Subscriver_ActivateDate     datetime    Unchecked
Subscriver_DeactivateDate   datetime    Checked

Now When the user signed up, i need to check whether he’s already existed in the table.

If not, Create a new record.

If so, check whether the user is active.

If not, activate it. update the activate date.

If so, return he’s already signed up.

INSERT INTO 
[ZCustom_SubscriberList] 
(Subscriber_Initial,Subscriber_Name,Subscriber_Email,Subscriber_Group,Subscriber_Date) 
select @initial,@name,@email,'A1',@subdate 
WHERE NOT EXISTS (SELECT * FROM [ZCustom_SubscriberList] WHERE Subscriber_Email=@email)

This is my code and it is working fine without Active column. I am wondering how to add in the activate part.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:54:46+00:00Added an answer on May 26, 2026 at 9:54 pm

    Something like this should work: (Disclaimer: this is untested code, but you should get the general idea)

    create procedure AddUser
        @NewUserName varchar(50)
    as
    
        set nocount on;
    
        declare @SubscriberActive bit
    
        if exists
        (
            select *
            from YourUserTable
            where subscriber_name = @NewUserName
        )
        begin
            select @SubscriberActive = subscriber_active
            from YourUserTable
            where subscriber_name = @NewUserName
    
            if @SubscriberActive = 0
            begin
                update YourUserTable
                set subscriber_active = 1,
                    subscriber_activedate = getdate()
                where subscriber_name = @NewUserName
            end
        end
        else
        begin
            insert into YourUserTable(subscriber_name) -- fill in the rest of your not null fields
            values(@NewUserName)
        end
    go
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tbl_names with following fields: Id int Name nvarchar(10) family nvarchar(20) Id Name
I have tried the following two statements: SELECT col FROM db.tbl WHERE col (LIKE
var nextRow = tbl.tBodies[0].rows.length; var row = tbl.tBodies[0].insertRow(nextRow); row.setAttribute('ondblclick', return move_to_x_graph();); This code will
function showContent(tableID) { var tbl = document.getElementById(tableID); var rCount = tbl.rows.length; try { alert(tbl.rows[rCount
I have the following tables: 1) TBL (ID, Data, LastUpdated, DateCreated) 2) TBL_LOG(Log_ID, LogCreateDate,
tbl_product Name | Creator | UID | Salerank tbl_price Supplier | Price | UID
In my SQL database there're many fields like this: Field Type:Text Null:Yes Default:NULL My
my sql statement is something like this below DECLARE @OLD_NAV_VALUE AS INT DECLARE @FINAL
How do I change all the column values (Nullable=True and Allow Zero Length=True) in
I have a table tbl with 3 columns imp_col, data1, data2 where imp_col's type

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.