Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Procedures

Author  Topic 

BasicSQL
Starting Member

10 Posts

Posted - 2011-11-04 : 07:58:25
Hello

I have a question on Procedures, On the insert and update procedure you have to specify Parameters for the procedure to be executed but i was wondering if there was away to create a procedure without any parameters . Is it possible? i feel there must be a way and i am testing Various procedures out but i haven't had any luck.

Thank for taking time to read my thread and thank you in advanced for you answers

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2011-11-04 : 08:03:37
Where are you looking to insert data from? If it is another table, it is as simple as:

CREATE PROCEDURE myproc
AS
INSERT INTO table
SELECT <fields> FROM othertable
GO
Go to Top of Page

BasicSQL
Starting Member

10 Posts

Posted - 2011-11-04 : 08:07:00
Well the Database is hosted on PC A and i have DB on PC B and what i am looking to do is id to update and insert data from PC A DB to PC B DB just one on single table on either DB's
Go to Top of Page

BasicSQL
Starting Member

10 Posts

Posted - 2011-11-04 : 08:11:36
The problem with the update is that it replies on the parameters to update the data so i feel there's no escaping the parameters for the update
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-04 : 08:11:48
then it should be like

USE [B]
CREATE PROCEDURE myproc
AS
INSERT INTO dbo.table
SELECT <fields> FROM A.dbo.othertable
GO


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

BasicSQL
Starting Member

10 Posts

Posted - 2011-11-04 : 08:24:23
No I have done a couple procedures insert and updates and it needs the parameters in the procedures in order to insert the data and update the data anyway thanks for your help
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-04 : 12:51:36
quote:
Originally posted by BasicSQL

No I have done a couple procedures insert and updates and it needs the parameters in the procedures in order to insert the data and update the data anyway thanks for your help


no mandatory requirement that it should have parameters. If you just want to populate one db table based on another table, there's no need for any parameters

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -