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 3498746
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:31:38+00:00 2026-05-18T12:31:38+00:00

What i wana do is actually process some data then insert the processed data

  • 0

What i wana do is actually process some data then insert the processed data into a new table..
but first i need to check the target table ;if empty then delete everything in the table then only insert the fresh processed data..

i’m using sql server 2008…

anyone can give me the sample sql code to create the stored procedure??

  • 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-18T12:31:38+00:00Added an answer on May 18, 2026 at 12:31 pm
    create procedure SprocName
    AS
    BEGIN
      DECLARE @ProcessedData AS TABLE (IntColumn int, CharColumn varchar(MAX))
    
      -- get processed data
      INSERT INTO @ProcessedData (IntColumn, CharColumn)
      SELECT IntValue, CharValue FROM SourceTable -- WHERE your condition
    
      -- check target and delete
      IF EXISTS (SELECT * FROM TargetTable)
      BEGIN
        DELETE FROM TargetTable -- WHERE your condition
      END
    
      -- insert fresh
      INSERT INTO TargetTable (IntColumn, CharColumn)
      SELECT IntColumn, CharColumn FROM @ProcessedData
    
    END
    

    Sorry code not tested 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wana develop a multi-player chess using c# but I don't have any idea
I wana to call a web page and don't need response from page. just
hi all i wana ask a question about crystal reporting in vs 2008 lets
i have made a urdu editor using swing in java and now wana add
I am required to generate a Pivot table in MS Excel(not in Open Office)
I just installed ubuntu on my PC, and now I wish to browse into
2 months ago I was writing a web-application which use some classes to draw
I wana know if we can make a partial specialized class as a friend
I have the following strings in a text file test Table Name.type Market Drinks.tea
In the following code, How can I check for null reference exception in a

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.