473,320 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Store Procedure Insert in "X" rows

Hi:

I want to create an store procedure for an ASP page.
I've a form with 100 fields and I want to insert the information in:

1) one table with 100 rows
or
2) in 5 tables

Now, my idea is create an store procedure for insert BUT if tomorrow I need to add more fields and rows in sql, I would like not touch nothing in my code.

So I want an automatically insert.

Anyone has examples, tutorial or link for access to that information.

thank you
NIKO
Jul 5 '07 #1
3 2059
srinit
43
Hi:

I want to create an store procedure for an ASP page.
I've a form with 100 fields and I want to insert the information in:

1) one table with 100 rows
or
2) in 5 tables

Now, my idea is create an store procedure for insert BUT if tomorrow I need to add more fields and rows in sql, I would like not touch nothing in my code.

So I want an automatically insert.

Anyone has examples, tutorial or link for access to that information.

thank you
NIKO

I am not clear with your question.
if u want rows dynemically
then send the rows no as input to ur procedure
then use this idea
[code]
declare @x varchar(500)
set @x=''
while(@a>0)
begin
set @x=@x+','row+@a
set @a=@a-1
end
exec( 'create table tname('+ @x+ ')')
Jul 9 '07 #2
Infide
28
Hi:

I want to create an store procedure for an ASP page.
I've a form with 100 fields and I want to insert the information in:

1) one table with 100 rows
or
2) in 5 tables

Now, my idea is create an store procedure for insert BUT if tomorrow I need to add more fields and rows in sql, I would like not touch nothing in my code.

So I want an automatically insert.

Anyone has examples, tutorial or link for access to that information.

thank you
NIKO
If I understand your question correctly there are two methods you could go with.
As long as your two tables match in column order and type you could do this:

INSERT INTO Table1
SELECT * From Table2

This probably won't work for very long. However, by hitting the system tables you could dynamically create your stored proc.

Try the systables and sysobjects system tables to dynamically pull the column names and build your insert statement.
Jul 10 '07 #3
Thanks guys for your response.

I want an automatic insert.
I've an ASP page with more than 50 fields (form) and I want to an insert all that information in a table in SQL server 2005.

Now, I've statments for insert BUT I need to create en automatic insert, because sometimes I need to add new fields o remove some fields, and I dont want to modify the insert statment every time I add a new file.

I dont know if I explain better my idea.

I really appreciate any help

Thank you
Jul 18 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: grumfish | last post by:
I'm trying to add a row to a MySQL table using insert. Here is the code: connection = MySQLdb.connect(host="localhost", user="root", passwd="pw", db="japanese") cursor = connection.cursor()...
0
by: Luis | last post by:
I'm using a SQL Server 2000 stored procedure similar to the one below to upload data to a database. This data is collected from the user on a number of asp pages and stored in session variables...
1
by: smile | last post by:
Hi All I want to insert rows from a table in a server into another table in another server using INSERT SELECT command. For example : INSERT INTO Server1.database1.dbo.Tab1 SELECT * FROM...
5
by: Gustavo Randich | last post by:
Hello, I'm writing an automatic SQL parser and translator from Informix to DB2. Now I'm faced with one of the most difficult things to translate, the "foreach execute procedure" functionality...
2
by: Mansi | last post by:
I'm trying to automate excel from c#. One of the things I need to do is to copy/paste/insert rows in excel via c# code. I tried to do the following: 1) Select a row in excel (a12 to k12) 2)...
2
by: Benny Ng | last post by:
The authentication code of enterprise libiary like the following: IAuthenticationProvider authenticationProvider = AuthenticationFactory.GetAuthenticationProvider(); IIdentity identity;...
4
by: RG | last post by:
Using VB.NET, How do I insert rows from a SQL Server table into an Access table with the same structure (and also the reverse, from Access to SQL)? I’m new to this, so here’s what I’ve...
20
by: Mark Harrison | last post by:
So I have some data that I want to put into a table. If the row already exists (as defined by the primary key), I would like to update the row. Otherwise, I would like to insert the row. I've...
6
by: kareemaffan | last post by:
Hello Everyone I want to insert values into MS Access database through VB.NET in Visual Studio 2005 . I have used the following code which is not working. Private Sub Button2_Click(ByVal sender...
2
by: gnewsgroup | last post by:
I am new to the asp.net Table web control. I am using it to customize my presentation of data. I cannot implement the idea with DataGrid or GridView. Basically, I would like to have something...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.