User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 374,181 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,409 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 983 | Replies: 1
Reply
Join Date: Nov 2004
Posts: 225
Reputation: sam1 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
sam1's Avatar
sam1 sam1 is offline Offline
Posting Whiz in Training

update table using function

  #1  
Mar 18th, 2008
hi,

I have a table with two columns. i want to insert into first column the values of 2nd column where it is between 7 and 10. the table is #temp as well.

so i can not use views... i need to make a function. can you guys please help me how to do it and if you could explain it would be great.

thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2006
Location: Egypt
Posts: 743
Reputation: RamyMahrous is on a distinguished road 
Rep Power: 3
Solved Threads: 53
Featured Poster
RamyMahrous's Avatar
RamyMahrous RamyMahrous is online now Online
Master Poster

Re: update table using function

  #2  
Mar 18th, 2008
View won't help and I think UDF (User Defined Function) won't help too, the best practice is to use Stored Procedure

  1. CREATE procedure sam1
  2. AS
  3. INSERT INTO tableX(column2) VALUES (SELECT column1 FROM tableX)
Last edited by RamyMahrous : Mar 18th, 2008 at 1:36 pm.
B.Sc Computer Science, Helwan University
Microsoft Student Partner
Personal blog http://ramymahrous.blogspot.com/
Arabic technical blog http://fci-h-ar.blogspot.com/
English technical blog http://fci-h.blogspot.com/
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MS SQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 4:42 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC