.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

Create Insert Proc and Distribute The amount

Posted By:      Posted Date: October 10, 2010    Points: 0   Category :Sql Server

I want To Create a Insert Store Proc for MonyReceive Table. It will Distribute The Amount in Invoice Details Table. Like If any Customer has Three Due Bill and Due Amount Is $110 ($50+$30+$40). If He going to pay like $ 100. I want to distribute the amount in three bills from first date of Customer Invoice. Please See the  Table Below




CustomerID  Date InvoiceID Amount Padi MonyReceiveId Due

19 12-Jan-2010 501 00

19 17-Jan-2010 508 $ 30 30 1 00


119 19-Jan-2010 510 $ 40 20 1<

View Complete Post

More Related Resource Links

How To Create Dynamic Insert Store Proc


I want to Create a Insert Procedure for Table which has Three Coloum I want to use this Insert Store Proc for another table which has two coloum. If it works then I don't Have to create more Store Proc for Every Table One Insert Proc will Serve my Purpose I am My giving my proc below

Create Proc All_Insert


@Name varchar (30),

@Phone varchar (15)

@Mobile Varchar (15)





insert into Table1














create and insert into a dynamic sql table at runtime

Below I have a bunch of SQL statements that creates a table at runtime and the "pic" column is a dynamic column and the code creates the number of "pic" columns depending on the count of the uploader control.  the problem comes when I try to insert into that table and I am trying to say for every "pic" declare variable @pic.... it works well for just one file in the uploader but for multiple files i get the following error The name "pic1" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.Directory.CreateDirectory(MapPath(".") & "\port\" & clientname.Text & "\")        Dim objConn As New SqlConnection("Data Source=xxxxxxxxx.hostedresource.com; Initial Catalog=mrpoteat; User ID=xxxxxxx; Password=xxxxxxxxx;")        objConn.Open()        Dim strCommandText As String = ""        For index = 1 To Attachments1.Items.Count Step 1            If String.IsNullOrEmpty(strCommandText) Then                strCommandTex

(SQL Server 2008) Exporting entire databases to SQL CREATE/INSERT statements

Hi All, I'm looking for a way to export SQL Server 2008 (Express or otherwise) databases to CREATE/INSERT statements.  I've seen a million threads (give or take) with instructions for creating large (often illegible) TSQL scripts for the task.  However, I'm hoping that this isn't the only way by which to do it.  I have need to regularly back up the data from existing MS SQL Server DBs (which are used by some of our standard apps) to various other MySQL and PostgreSQL databases (which are used by PHP and Rails web front ends).  I need to export them from MS SQL Server 2008 to a general format (i.e. INSERT statements) and perform regex edits on the file as necessary. FYI, I've written a few applications that connect to the various DBs over ODBC, etc. and transfer the data row by row.  You can image how painful this process is... I realize that there are many tools that do this.  However, most of them approach the issue from the standpoint of migration, and not that of regularly scheduled backups.  Also, this tool will need to eventually be distributed so having to purchase a license for the migration app for each person/group simply isn't feasible. Anyway, if you guys have a quality, straightforward solution to this issue, it would certainly be appreciated. Best.

Create Insert Procuder for Multipul Table

I have Three Tables in My Database Which has common field I want to send Data from My Vb.net project by Store Procudure I will send the Table Name by parameter The Procudure is like below. Please let me know how can I make one Insert Procudere for Three Tables     Create Proc Insert ( @FormName varchar (30), @Name varchar (30), @Phone varchar (15) ) as insert into @FormName ( [Name], Phone ) Values  ( @Name, @Phone )        

How can I avoid error a Insert Store proc if he don't find any coloum in a table


I have created one Insert Proc for a table which has three Colourm. 

Id int, [Name] varchar (30), Phone varchar (15) I want to use this proc for another Table which has two coloum which is semiler with first table lie   Id int, [Name] varchar (30) I want to use one Insert Store Proc For two Table. I can avoid null value of parameter but but can't avoid if the coloum is not exist. 



How I can Create update Proc for Multipul Table by Id


How I can Create update Proc for Multipul  Table by Id . I will send the Table Name In parameter from my Vb.net Project which Table I need to Update. I am Giving the Sample in Below but it does not working

Help me regarding This Mattter

alter Proc Catagory_Update



@Table varchar (30),

@Name varchar (30),

@Id int





@sql nvarchar(MAX)


@sql = 'Update '+@Table+

'Set ([Name] = @Name)

where id = @id'


sp_executesql @SQL,N'@Name Varchar(30),@id int',@Name,@id



How to collet Id from Dynamic Insert Proc


How Can I Collect Last Value by Dynamic Insert Proc. I Already Create it work for Insert but if I add  select scope_identity (); it does not work



Proc OneTest





Is There Other Methods to Create and INSERT data into A SQL Database besides ADODB.Connection


OK - I have everything working on my Production computer to find out that when I upload my page to my Shared Hosting Server, to find out my application will not work because I do not have high enough permissions to for aspcompat to be true.

This works on my development server which of course I have full access to:


        'Creating Connection Object and opening the database
        con = Server.CreateObject("ADODB.Connection")

        'Done. Close the connection
        con = Nothing
        Response.Write("Your Information was Successfully Added.")


Is there another method to execute my  sql string (which contains my INSERT INTO statement, and is in my .vb code file ) with just a Medium Access Level?  Other wise I will have to purchase a Dedicated server, which currently I can not really afford!


How to Insert - Update - Create articles to tbl_Articles table by using FCKeditor ASP.Net MVC


I read many post about Intergrating Fckeditor to ASP.Net MVC, and I have done.

Now, I have tbl_Articles table, it contain some articles... How to Insert - Update - Create articles from TextArea of FCKeditor (ASP.Net MVC)

Please give some way for me. Thanks.

Create XML file after inserT





I'd like to create a xml file after a insert of a record automaticlly how does I solve this?

I know I can create a trigger to do something after a insert but how to create an xml file and place it somewhere.


using SQL Server 2005





create proc with execute as


I read the documentation http://msdn.microsoft.com/en-us/library/ms188354(SQL.90).aspx but can't seem to replicate what I seemingly understood from this.

From what I understand if you just create a stored proc without the 'execute as' option, then the default is 'execute as caller'. Am I correct about this?

To test this scenario, I did the following.

(1) As a sysadmin, I created a simple stored proc in a test database to simply delete some data from a table in that database. The stored proc was created without the execute as option. (so if my understanding is correct, then it executes under the permission of the caller.)

(2) As a sysadmin, I created a dummy login and mapped that login to the test database and gave the user no other permission than to execute that stored proc. So, if that user tries to delete anything from that table, he gets a permission denied error.

(3) Next, I execute the test stored procedure logged in as the dummy user. The procedure runs (since the dummy user was given the execute permission), but to my surprise the procedure deletes the data.

What am I missing?

As a side note, after I did the above test, I alter the stored proc and played with both 'execute as caller' and 'execute as 'dummy'' and stil

bcp or bulk insert - create table


I saw another entry on this, however it went unanswered.  I'll try again and maybe there is newer information/functionality now and hopefully it will help both of us.

I intended to use bcp as one component of an archival process.  However, during a test to recreate or insert into a new table I do not see any switches or options to tell bcp to create the table if it doesn't exist.  Since the formtat file contains the column descriptors, I would have expected bcp to provide the create table functionality (rather than having to know the orignal table format and hardcoding the create table definition into the recover or reload process).  An I overlooking something?  Is there some new functionality using XML format files that would do this?

bcp bulk insert create table invalid object name

controlled insert statements in a stored proc


can any one pls tell me if it is able to do something like this inside stored procedure, i  know its possible in ssis or using sql agent jobs and schedule step wise, but within a stored proc, is it possible

task 1:

insert into table1

select * from table 1


if (task1) succeds


insert into table 2

select * from source2

task3:(execute only if task 2 succeeds)

insert into table3

select * from source 3



Insert value using Table Value Functions

a real gem in Sql Server 2008. mostly people still using Stored procedure may be they shifted to SQL Server but they are not using TVF right now.

Insert Rows with a GridView

In ASP.NET version 1.x, I used the footer on the DataGrid control to insert new rows by placing a series of TextBox, DropDownLists, CheckBoxes etc. controls on it and then handling a save button. This also works with the GridView in version 2.0 but with one major exception: if your data source is empty, the GridView will hide your footer (and header) and only display the EmptyDataText.

How to create 3 tier application using LINQ

As you know that in 3 tier architecture there are three layers

User interface layer. (Is our Form in Windows application and .aspx page in Web application)
Data Access layer. (Which provides interface between Business logic layer and Database)
Business Logic layer.(Which stores your application logic)

Create ToolTip for GridView Header

The following allows you to add a tooltip to the header links of your GridView, a feature that is lacking.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend