Insert Into Sql Database With Checkbox List Items

May 1, 2008

I am trying to insert into a database Checkbox list items, I get good values up till the checkBox List and then it gives me all O's, My fields in my database are bit columns so I need the checkbox list itmes to be converted to this format.  This is what i have so far.  One thing is I don;t think I am inserting into the correct database columns.  bitLOD, bitInjury, bitIllness, bitreferral are the database fileds.Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

'Check for the page ID to make sure not an update page then either insert new data or update existing data.

Dim id As String

Dim LOD As Byte

Dim Injury As Byte

Dim Illness As Byte

Dim Referral As Byte

id = Trim(Request.QueryString("ID"))For Each LItems As ListItem In CheckBoxList1.Items

If LItems.Selected = True ThenSelect Case LItems.ValueCase "1"

LOD = 1Case "2"

Injury = 1Case "3"

Illness = 1Case "4"

Referral = 1

End Select

End If

Next

'Put data into the Database

If id = "" Then

'save data into the database

sql = "INSERT tblSADHealth (intTaskForceID, intUICID, strSSN, dtInjury, strNotes, LOD, Injury, Illness, Referral,) " _

& "VALUES (" & ddlTaskForce.SelectedValue & ", " & DDLUIC.SelectedValue & ", '" & txtSSN.Text & "', '" & txtStatus.Text & "', " _

& "'" & txtDate.Text & "','" & txtNotes.Text & "', " & LOD & ", " & Injury & ", " & Illness & ", " & Referral & ")"

Response.Write(sql)

Response.End()

View 4 Replies


ADVERTISEMENT

Select List Contains More Items Than Insert List

Mar 21, 2008

I have a select list of fields that I need to select to get the results I need, however, I would like to insert only a chosen few of these fields into a table. I am getting the error, "The select list for the INSERT statement contains more items than the insert list. The number of SELECT values must match the number of INSERT columns."
How can I do this?

Insert Query:
insert into tsi_payments (PPID, PTICKETNUM, PLINENUM, PAMOUNT, PPATPAY, PDEPOSITDATE, PENTRYDATE, PHCPCCODE)
SELECT DISTINCT
tri_IDENT.IDA AS PPID,
tri_Ldg_Tran.CLM_ID AS PTicketNum,
tri_ClaimChg.Line_No AS PLineNum,
tri_Ldg_Tran.Tran_Amount AS PAmount,

CASE WHEN tln_PaymentTypeMappings.PTMMarsPaymentTypeCode = 'PATPMT'
THEN tri_ldg_tran.tran_amount * tln_PaymentTypeMappings.PTMMultiplier
ELSE 0 END AS PPatPay,

tri_Ldg_Tran.Create_Date AS PDepositDate,
tri_Ldg_Tran.Tran_Date AS PEntryDate,
tri_ClaimChg.Hsp_Code AS PHCPCCode,
tri_Ldg_Tran.Adj_Type,
tri_Ldg_Tran.PRS_ID,
tri_Ldg_Tran.Create_Time,
tri_Ldg_Tran.Adj_Group,
tri_Ldg_Tran.Payer_ID,
tri_Ldg_Tran.TRN_ID,
tri_ClaimChg.Primary_Claim,
tri_IDENT.Version
FROM [AO2AO2].MARS_SYS.DBO.tln_PaymentTypeMappings tln_PaymentTypeMappings RIGHT OUTER JOIN
qs_new_pmt_type ON tln_PaymentTypeMappings.PTMClientPaymentDesc =
qs_new_pmt_type.New_Pmt_Type RIGHT OUTER JOIN
tri_Ldg_Tran RIGHT OUTER JOIN
tri_IDENT LEFT OUTER JOIN
tri_ClaimChg ON tri_IDENT.Pat_Id1 =
tri_ClaimChg.Pat_ID1 ON tri_Ldg_Tran.PRS_ID =
tri_ClaimChg.PRS_ID AND
tri_Ldg_Tran.Chg_TRN_ID =
tri_ClaimChg.Chg_TRN_ID
AND tri_Ldg_Tran.Pat_ID1 = tri_IDENT.Pat_Id1 LEFT OUTER JOIN
tri_Payer ON tri_Ldg_Tran.Payer_ID
= tri_Payer.Payer_ID ON qs_new_pmt_type.Pay_Type
= tri_Ldg_Tran.Pay_Type AND
qs_new_pmt_type.Tran_Type = tri_Ldg_Tran.Tran_Type
WHERE (tln_PaymentTypeMappings.PTMMarsPaymentTypeCode <> N'Chg')
AND (tln_PaymentTypeMappings.PTMClientCode = 'SR')
AND (tri_ClaimChg.Primary_Claim = 1)
AND (tri_IDENT.Version = 0)

View 2 Replies View Related

Insert Only New Items From A List But Get ID's For New And Existing In The List.

Feb 12, 2008

Hi,

I have a a table that holds a list of words, I am trying to add to the list, however I only want to add new words. But I wish to return from my proc the list of words with ID, whether it is new or old.

Here's a script. the creates the table,indexes, function and the storeproc. call the proc like procStoreAndUpdateTokenList 'word1,word2,word3'

My table is now 500000 rows and growing and I am inserting on average 300 words, some new some old.

performance is a not that great so I'm thinking that my code can be improved.

SQL Express 2005 SP2
Windows Server 2003
1GB Ram....(I know, I know)

TIA





Code Snippet
GO
CREATE TABLE [dbo].[Tokens](
[TokenID] [int] IDENTITY(1,1) NOT NULL,
[Token] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [PK_Tokens] PRIMARY KEY CLUSTERED
(
[TokenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

CREATE UNIQUE NONCLUSTERED INDEX [IX_Tokens] ON [dbo].[Tokens]
(
[Token] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = ON, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE FUNCTION [dbo].[SplitTokenList]
(
@TokenList varchar(max)
)
RETURNS
@ParsedList table
(
Token varchar(255)
)
AS
BEGIN
DECLARE @Token varchar(50), @Pos int
SET @TokenList = LTRIM(RTRIM(@TokenList ))+ ','
SET @Pos = CHARINDEX(',', @TokenList , 1)
IF REPLACE(@TokenList , ',', '') <> ''
BEGIN
WHILE @Pos > 0
BEGIN
SET @Token = LTRIM(RTRIM(LEFT(@TokenList, @Pos - 1)))
IF @Token <> ''
BEGIN
INSERT INTO @ParsedList (Token)
VALUES (@Token) --Use Appropriate conversion
END
SET @TokenList = RIGHT(@TokenList, LEN(@TokenList) - @Pos)
SET @Pos = CHARINDEX(',', @TokenList, 1)
END
END
RETURN
END
GO

CREATE PROCEDURE [dbo].[procStoreAndUpdateTokenList]
@TokenList varchar(max)
AS
BEGIN
SET NOCOUNT ON;
create table #Tokens (TokenID int default 0, Token varchar(50))
create clustered index Tind on #T (Token)
DECLARE @NewTokens table
(
TokenID int default 0,
Token varchar(50)
)

--Split ID's into a table
INSERT INTO #Tokens(Token)
SELECT Token FROM SplitTokenList(@TokenList)
BEGIN TRY
BEGIN TRANSACTION
--get ID's for any existing tokens
UPDATE #Tokens SET TokenID = ISNULL( t.TokenID ,0)
FROM #Tokens tl INNER JOIN Tokens t ON tl.Token = t.Token

INSERT INTO Tokens(Token)
OUTPUT INSERTED.TokenID, INSERTED.Token INTO @NewTokens
SELECT DISTINCT Token FROM #Tokens WHERE TokenID = 0

return the list with id for new and old
SELECT TokenID, Token FROM #Tokens
WHERE TokenID <> 0
UNION
SELECT TokenID, Token FROM @Tokens
COMMIT TRANSACTION
END TRY
BEGIN CATCH
DECLARE @er nvarchar(max)
SET @er = ERROR_MESSAGE();
RAISERROR(@er, 14,1);
ROLLBACK TRAN
END CATCH;
END
GO




View 5 Replies View Related

!!help!! How To Save User Inputs From Checkbox List To Database??

Dec 11, 2007

Hi,
 
I'm new to ASP.NET 2.0. I'll like to ask how do one save user input from txtbox, radiobttnlist or checkboxlist into database?
Im implementing a suvrey form here by the way.
 -any reference webs,
-any pointers from experts?
Thank you for your time in reading this email
 
Kayln

View 7 Replies View Related

Select Query To Fetch Multiple Checkbox Items

Nov 15, 2013

I have a dropdown list with checkbox and when I select multiple options and search, its returning only the last selected value in the grid. Here is the code I use it for search. Designation is the column where I bind its values to the checkbox.

Checkbox tag:
<asp:CheckBoxList ID="cblGroup" Style="vertical-align: baseline" runat="server" CssClass="chkbox">
</asp:CheckBoxList>

Select Query:SqlCommand cmd = new SqlCommand("select * from AppInvent_Test where Designation= '" + cblGroup.SelectedValue + "'", con);

View 2 Replies View Related

Items In List A That Don't Appear In List B (was Simple Query...I Think)

Jan 20, 2005

Ok, I want to write a stored procedure / query that says the following:
Code:
If any of the items in list 'A' also appear in list 'B' --return false
If none of the items in list 'A' appear in list 'B' --return true


In pseudo-SQL, I want to write a clause like this

Code:

IF
(SELECT values FROM tableA) IN(SELECT values FROM tableB)
Return False
ELSE
Return True


Unfortunately, it seems I can't do that unless my subquery before the 'IN' statement returns only one value. Needless to say, it returns a number of values.

I may have to achieve this with some kind of logical loop but I don't know how to do that.

Can anyone help?

View 3 Replies View Related

Build SQL Query From Dynamic Checkbox List

Nov 26, 2003

Not sure if this is the place to post this, but here goes.

I need to setup an options screen where my customers can customize which locations will be stored for their user id when pulling reports. I have checkbox list that dynamically loads their locations. I need to store the selected checkbox items in my table and then each time they login in to run a report, it will use the stored Location values in my SQL query.

Synopsis:
Selected locations stored in table. When the report is ran, the location values are pulled and added to my queries WHERE clause.

Thanks.

View 1 Replies View Related

Without Checkbox Leftside Of The Dropdown Value List Of The Parameter

Feb 5, 2007

Hi,

I believe somebody know the reason. Please help me on it!

I plan to pass a multivalued parameter from my web application to the server report, and let user select the value(s) from the value set. But when I run the report, there's no checkbox leftside of the values, that means user has no choice on this parameter.

Is there any way to do it?

Thanks,

Jone

View 2 Replies View Related

List Items Once

Aug 22, 2014

how can run a query that would not list duplicate e.g.

item 1 section 1
item 2 section 1
item 3 section 1
item 4 section 1
item 5 section 2
item 6 section 2
item 7 section 3

the output would be

section 1
section 2
section 3

View 1 Replies View Related

SELECT Using All Items From List

Nov 7, 2006

I need to create a stored procedure that takes a list of product
numbers(541, 456, CE6050,...) and selects only the customers that have
all product numbers in the list. I have a product table that has the
following schema:

rowid numeric(18,0),productNumber numeric(5,0),customerNumber numeric(5,0)

and a customer table:

customerNumber numeric(5,0),address varchar(50),contact varchar(50)

So a customer can have more than one product, but I need a select
statement that takes the product numbers and selects them against the
product table and returns only the customerNumbers that have the entire
list of product numbers. I have tried doing a join on the product list and productNumber, then join with the customer table on customerNumber, but that gets any entires found in the list not the entries that have all the product numbers.  Thanks in advance for any help.

View 1 Replies View Related

List Of Items By Supplier

Jan 14, 2008

Hi,

I have the following table Descriptions:-

Item No. -- Supp1-- Supp2-- Supp3 .... Supp10


I want to have a list of items for each supplier on the tables showing the following:-

Header is the Supplier No.
Details of each item Item No


Thanks for your help

View 2 Replies View Related

Trying To Insert Checkbox True/false Into Db

Aug 15, 2005

Hi there, I've tried googling this (and looking at the many questions on the forum :) but I've not managed to find a decent tutorial / guide that describes a method for using checkboxs to insert true/false flags in a MS SQL db.  The db field i'm setting has type set to "bit", is this correct?  And secondly (its been a long day!) I just cant figure out the code to assign the bit 1 or 0 / true or false. This is what I've got so far but it's not working........Function InsertProduct(ByVal prod_code As String, ByVal prod_name As String, ByVal prod_desc As String, ByVal prod_size As String, ByVal prod_price As String, ByVal prod_category As String, ByVal aspnet As Boolean) As Integer             Dim connectionString As String = "server='server'; user id='sa'; password='msde'; Database='dbLD'"             Dim sqlConnection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionString)                 Dim queryString As String = "INSERT INTO [tbl_LdAllProduct] ([prod_code], [prod_name], [prod_desc], [prod_size], [prod_price], [prod_category],[aspnet]) VALUES (@prod_code, @prod_name, @prod_desc, @prod_size, @prod_price, @prod_category, @aspnet)"             Dim sqlCommand As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(queryString, sqlConnection)                 sqlCommand.Parameters.Add("@prod_code", System.Data.SqlDbType.VarChar).Value = prod_code             sqlCommand.Parameters.Add("@prod_name", System.Data.SqlDbType.VarChar).Value = prod_name             sqlCommand.Parameters.Add("@prod_desc", System.Data.SqlDbType.VarChar).Value = prod_desc             sqlCommand.Parameters.Add("@prod_size", System.Data.SqlDbType.VarChar).Value = prod_size             sqlCommand.Parameters.Add("@prod_price", System.Data.SqlDbType.VarChar).Value = prod_price             sqlCommand.Parameters.Add("@prod_category", System.Data.SqlDbType.VarChar).Value = prod_category                 If chkAspnet.Checked = True Then                sqlCommand.Parameters.Add("@aspnet","1")             Else                sqlCommand.Parameters.Add("@aspnet","0")             End If                     Dim rowsAffected As Integer = 0             sqlConnection.Open             Try                 rowsAffected = sqlCommand.ExecuteNonQuery             Finally                 sqlConnection.Close             End Try             Return rowsAffected         End Function             Sub SubmitBtn_Click(sender As Object, e As EventArgs)            If Page.IsValid then                InsertProduct(txtCode.Text, txtName.Text, txtDesc.Text, ddSize.SelectedItem.value, ddPrice.SelectedItem.value, ddCategory.SelectedItem.value, aspnet.value)                Response.Redirect("ListAllProducts.aspx")            End If    End SubAny help would be appreciated or links to tutorials.ThanksBen

View 2 Replies View Related

Can Pass List Of Items Through A Parameter?

Feb 12, 2014

I have a SQL query like this:

Select * from myTable where myTable_ID in (2,6,7,9)

I want to build the list of values that are in parenthesis, in my VB code and pass it in through a parameter, so it's like this:

Select * from myTable where myTable_ID in (@myValues)

Is this possible? I tried it where myValues = '2,6,7,9' but am getting a conversion error. I'm starting to believe it's not possible to do what I'm trying to do. Is there another way?

View 2 Replies View Related

Parameterized Query For A List Of Items

Sep 2, 2014

I am doing parameterized queries from Visual Basic in Visual Studio.

I have a query where I want to do something like this.

Select * from people where city in (<list of cities>)

The problem is I want to build my <list of cities> in Visual Basic and pass it to the SQL as a parameter.

I know I can't do this:

Select * from people where city in (@ListOfCities)

Currently, I'm doing this by writing the <list of cities> out to a separate table, just so I can do the query.

Select * from people where city in (Select CityName from CityTable)

View 4 Replies View Related

List Items From A Form Query

Feb 24, 2008

Hi,
I am a newbie, this is my first post (please go easy).

Iam at the moment trying to set up a query for someone looking for a property on an estate agents website.

From a drop down menu, the user can:
select an area (where they may like to live) from a list of areas.
select an amount of bedrooms from a list of bedrooms
select a minimum price from a list of prices
select a maximum price from a list of prices.

The query I worked out for this is as follows:
$data = mysql_query("SELECT * FROM property WHERE area like '$area' and bedrooms like '$bedrooms' AND price BETWEEN '$min_price' AND '$max_price'") or die(mysql_error());

This seems to work fine and shows all the properties that meet the criteria onto my webpage.

However, I then thought, someone may not care which area they live in and want to see all properties in all the areas, so I decided to add the option 'All areas' to my 'areas' list, I then did the same for the other lists, eg 'all bedrooms' option to my bedrooms list and so on.

I am now trying to write a query that incorporates where the 'all..' option is selected and have become very stuck!
Can someone set me off in the right direction for this.
I hope that makes sense?!?!

View 20 Replies View Related

How Do I Insert Datagridr Checkbox Into SQL Bit Fields Using A SqlDataSource

Apr 13, 2006

Dim strStatus As String
Dim strGroup As String
Dim strLicense As String = dtgPhysician.DataKeys(e.Item.ItemIndex)
Dim strUpdateStatus As String
Dim strUpdateGroup As String
Dim strName As String
Dim strDate As String
Dim strSubject As String
Dim blPDA As Boolean
Dim strPDA As Byte
strStatus = CType(e.Item.FindControl("lstStatus"), DropDownList).SelectedItem.Text
strGroup = CType(e.Item.FindControl("txtGroup"), TextBox).Text
strName = e.Item.Cells(1).Text.Trim
strDate = CType(e.Item.FindControl("txtDate"), TextBox).Text
strSubject = CType(e.Item.FindControl("dpTraining"), DropDownList).SelectedItem.Text
blPDA = CType(e.Item.FindControl("ckPDA"), CheckBox).Checked
strPDA = Convert.ToString(blPDA)

strUpdateStatus = "UPDATE DoctorMaster SET Status = @p_Status , PGroup=@p_Group , @p_PDA wHERE (PLIC= @p_License);"
' ... Make a SQL call to update the database ...
'UpdatePhysician
Dim strConn As String
strConn = ConfigurationSettings.AppSettings("ConString")
If strConn = String.Empty Then
myConn = New SqlConnection()
Else
myConn = New SqlConnection(strConn)
End If
myConn.Open()
Dim daPhysician As New SqlDataAdapter()
Dim comUpdate As New SqlCommand()
comUpdate.Connection = myConn
daPhysician.UpdateCommand = comUpdate
comUpdate.CommandType = CommandType.Text
comUpdate.CommandText = strUpdateStatus
'Return the DataGrid to its pre-editing state
comUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@p_Status", System.Data.SqlDbType.Char, 3, "Status")).Value = strStatus
comUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@p_Group", System.Data.SqlDbType.NVarChar, 15, "PGroup")).Value = strGroup
comUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@p_License", System.Data.SqlDbType.NVarChar, 15, "PLIC")).Value = strLicense
 
comUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@p_PDA", System.Data.SqlDbType.Bit, "PDA")).Value = CType(e.Item.FindControl("ckPDA"), CheckBox).Checked.ToString

comUpdate.ExecuteNonQuery()

comUpdate.Dispose()
 
Thanks.
It kept givimg me data  format error.

View 1 Replies View Related

Getting List Of Recently Added IDENTITY Items

Mar 8, 2006

In a multi-user environment, I would like to get a list of Idsgenerated, similar to:declare @LastId intselect @LastId = Max(Id) From TableManiaINSERT INTO TableMania (ColumnA, ColumnB)SELECT ColumnA, ColumnB From OtherTable Where ColumnC > 15--get entries just addedSELECT * FROM TableMania WHERE Id > @LastIdThe above works fine, except I'm assuming it will not work in amulti-user environment. Is there any way to get the set of Ids thatwere just added in the previous statement (similar to @@IDENTITY)without doing all of this in a serializable transaction or making atemp table of every single Id before the insert statement?

View 41 Replies View Related

INSERT, UPDATE, And DELETE Statement Checkbox Inactive

Mar 26, 2008

Hi  AllgI have problem in using the SQLDataSource. When in VS 2005 I drag and drop the SQLDataSource onto my page and then add a GridView control.I bind the GridView control to the SQLDataSource control. But the problem is it does not generate the INSERT, UPDATE, and DELETE statements. The dialog box is inactive. The screenshots may help. please help me in this regard. I also tried it for Accesscontrol but the same problem. Sorry for my poor English!. thanks in advancehttp://img205.imagevenue.com/img.php?image=27550_1_122_203lo.JPGhttp://img139.a.com/img.php?image=28285_2_122_937lo.JPG   

View 1 Replies View Related

INSERT, UPDATE And DELETE Statements Checkbox Inactive

Mar 26, 2008

I have problem in using the SQLDataSource. When in VS 2005 I drag and drop the SQLDataSource onto my page and then add a GridView control.I bind the GridView control to the SQLDataSource control. But the problem is it does not generate the INSERT, UPDATE, and DELETE statements. The dialog box is inactive. The screenshots may help. please help me in this regard. I also tried it for Accesscontrol but the same problem. Sorry for my poor English!. thanks in advance

the screenshot links:
http://img139.imagevenue.com/img.php?image=28285_2_122_937lo.JPGhttp://img205.imagevenue.com/img.php?image=27550_1_122_203lo.JPG 

View 7 Replies View Related

Make Items Bold In Parameter Selection List

Mar 19, 2007

Is it possible to make certain items in a parameter selection list appear bold?

View 3 Replies View Related

Delete Statement For A List Of Items With Multiple Columns Identifying Primary Key

Jul 7, 2006

I frequently have the problem where I have a list of items to delete ina temp table, such asProjectId Description------------- ----------------1 test12 test43 test34 test2And I want to delete all those items from another table.. What is thebest way to do that? If I use two IN clauses it will do it where itmatches anything in both, not the exact combination of the two. I can'tdo joins in a delete clause like an update, so how is this typicallyhandled?The only way I can see so far to get around it is to concatenate thecolumns like CAST(ProjectId as varchar) + '-' + Description and do anIN clause on that which is pretty nasty.Any better way?

View 2 Replies View Related

Why Dataflow Component Doesn't Appear In The List Of SSIS Data Flow Items?

Sep 5, 2007

Hi,
I developed SSIS Data Flow Component and placed dll file into the DTSPipelinecomponents. Then I registered the component in the GAC.

But when I try to add the required component into toolbox that there is not this one in the list of SSIS Data Flow Items. What does it mean?

Thanks in advance.

View 3 Replies View Related

Create A Table Of Contents Based On Report Items From A List Control

Apr 28, 2008

What are the options to create a table of contents based on the report items in a List Control? Document Mapping works for online viewing. A table of content would make the report easier to read when it's printed.

Any help is much appreciated. Thanks.

View 1 Replies View Related

Transact SQL :: Get List Of Items Present In Order Based On Confidentiality Code Of Product

Sep 29, 2015

I want to get the list of items present in that order based on the confidentiality code of that product or Item and confidentiality code of the user.

I display the list of orders in first grid, by selecting the order in first grid I display the Items present in that order based on the confidentiality code of that item.

whenever order in 1st grid is selected i want to display the items that the item code should be less than or equal to the confidentiality code of the logged-in user other items should not display.

If the all the items present in the order having confidentiality code greater than Logged-in user at that time the order no# should not display in the first grid.

Table 1:Order

Order_Id Order_No Customer_Id

2401 1234567 23
2402 1246001 24
2403 1246002 25

Table 2 : OrderedItems

OrderItem_Id Order_Id Item_Id Sequence

1567 2401 1001 1
1568 2401 1003 2
1569 2402 1005 1
1570 2402 1007 2
1571 2403 1010 1

Table 3: ItemMaster

Item_Id Item_Name confidentCode

1001 Rice Null
1003 Wheet 7
1005 Badham Null
1007 Oil 6
1010 Pista 8

Out put for 1st grid 

**Note :** Logged-in user have confidentiality code 6

Order No Customer
1234567 23
1246001 24

3rd order is not displayed in the grid

After user selects the 1st order in the grid then the items present in that 1st order should be displayed as 

1001     Rice

the second item not displayed because that having confidentiality code greater than user.

After user selects the 2nd order in the grid then the items present in that order should displays

1005 Badham
1007 Oil

I need the query to display the order details in 1st grid.

View 3 Replies View Related

SQL 2012 :: Pass List Items To Stored Proc As Comma Separated Parameter - Foreach Loop

Feb 11, 2015

I have a multiselect checkbox list in my UI. I pass the list items to my stored proc as comma separated parameter and then I have a function which converts this parameter to a table with separate rows.

E.g. : a,b,c,d

Converted to result table

result
a
b
c
d

I want to insert each row of the result table into another table. How to do that.

E.g., the table after the function is :

CREATE TABLE #result
(
Subject varchar(100)
)

insert into #result values ('a')
insert into #result values ('b')
insert into #result values ('c')
insert into #result values ('d')

So the pseudo code is something like

for each row in #result

insert row into another table

View 9 Replies View Related

Insert Value List Doest Not Match Column List

Apr 18, 2007

HI...



I need to do a simple task but it's difficult to a newbie on ssis..



i have two tables...



first one has an identity column and the second has fk to the first...



to each dataset row i need to do an insert on the first table, get the @@Identity and insert it on the second table !!



i'm trying to use ole db command but it's not working...it's showing the error "Insert Value list doest not match column list"



here is the script



INSERT INTO Address(
CepID,
Street,
Number,
Location,
Complement,
Reference)Values
(
?,
?,
?,
?,
?,
?
)
INSERT INTO CustomerAddress(
AddressID,
CustomerID,
AddressTypeID,
TypeDescription) VALUES(
@@Identity,
?,
?,
?
)



what's the problem ??

View 7 Replies View Related

Asp:Checkbox Addition To Database

May 12, 2008

I have a form set-up and am trying to add multiple items in my checkbox to the database; however, the only thing added to the database is the first item checked.  Here is the code and any help will be greatly appreciated.  Thank you!:<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConConnectionString %>" InsertCommand="INSERT INTO Consultations(FullName, Email, Business, BusinessInfo, Services, Comments) VALUES (@FullName, @Email, @Business, @BusinessInfo, @Services, @Comments)"
SelectCommand="SELECT Consultations.* FROM Consultations">
<InsertParameters>
<asp:ControlParameter Name="FullName" Type="String" ControlId="fullname" PropertyName="Text" />
<asp:ControlParameter Name="Email" Type="String" ControlId="emailTextBox" PropertyName="Text" />
<asp:ControlParameter Name="Business" Type="String" ControlId="bisDropDownList" PropertyName="SelectedValue" />
<asp:ControlParameter Name="BusinessInfo" Type="String" ControlId="businessTextBox" PropertyName="Text" />
<asp:ControlParameter Name="Services" Type="String" ControlID="checkboxlist" PropertyName="SelectedValue" />
<asp:ControlParameter Name="Comments" Type="String" ControlID="commentsTextBox" PropertyName="Text" />
 
</InsertParameters>
</asp:SqlDataSource>

View 3 Replies View Related

Storing Checkbox Values To Database

Mar 19, 2008

Hi i am trying to store the checkbox values on my page to the database, but im stuck on what to do. I have the following code already;protected void Btn_Subscribe_Click(object sender, EventArgs e)
{SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["streamConnectionString"].ConnectionString);
string strSQL = "INSERT INTO Newsletter(emailAddress) VALUES (@emailAddress)";SqlCommand Command = new SqlCommand(strSQL, conn);
Command.Parameters.Add("@emailAddress", SqlDbType.VarChar);Command.Parameters["@emailAddress"].Value = txtEmail.Text;
conn.Open();
Command.ExecuteNonQuery();
conn.Close();
}
How do i now insert the values from my checkbox, this is how i am setting the checkbox;public void Page_Load(object sender, EventArgs e)
{ArrayList values;if(!IsPostBack)
{
//Build array of data to bind to checkboxlistvalues = new ArrayList();
values.Add("Sport");values.Add("Gardening");values.Add("technology");
AlertList.DataSource = values;
AlertList.DataBind();
}
If i am going about it the wrong way please let me know, thanks

View 15 Replies View Related

How Do You Enter Checkbox Status In A Database Column??

Jun 4, 2008

Hi,

On my page I am using a wizard control with textboxes to collect data from the visitor.
When they click the finish button - this inserts their data into a Sql database.

On the form is a checkbox.
I dont know what type to use in the database column to accept this and also
how to configure the checkbox on the page so I know if its checked.

Also what would be inserted into the database column "yes" "no" or a numerical value??


Thanks for any advice?

amereto

View 1 Replies View Related

Inserting CheckBox Values Into A Database (MSSQL 2000)

Sep 12, 2005

I have been trying to add values to a database and it keeps failing
i have no idea what i am doing wrong please help the code is asp.net
using vb. I have been having serious trouble passing check boxes in
forms from day one both singularly and dynamically from datagrids
if someone could show me some sample code of how to pass these
sort of values into the component and on to the query in this way
i would very much appreciate it.

Fuzzygoth

the error returned is

Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException:
INSERT statement conflicted with COLUMN FOREIGN KEY constraint
'tblStation_FK00'. The conflict occurred in database 'TealSQL', table
'tblTravelPoint', column 'travelpointID'.
The statement has been terminated.

I have marked the area of the code the error is returned in the colour Violet and with a ##

The code i am using is below


## The aspx page ##

<%@ Page Language="vb" Debug="true" Trace="True"
Inherits="Devotion2Motion.AdminComp"
Src="../CodeBehind/AdminModule.vb"   %>
<!-- Binds the ActivityResortInfo.ascx user control to the page -->
<%@ Register TagPrefix="UserContol" TagName="D2MHeader" Src="../UserControls/Header.ascx" %>
<%@ Register TagPrefix="UserContol" TagName="D2MFooter" Src="../UserControls/Footer.ascx" %>
<%@ Register TagPrefix="UserContol" TagName="TravelPointDD" Src="../UserControls/TravelPointDD.ascx" %>
<script language="vb" runat="server">
   
    Sub Page_Load()
   
        If IsPostback = True Then
       
        Dim aInternational As Integer
       
        Dim Station As String = Request.Form("StationFrm")
        Dim Type As String = Request.Form("TypeFrm")
        Dim Address1 As String = Request.Form("address1Frm")
        Dim Address2 As String = Request.Form("address2Frm")
        Dim City As String = Request.Form("cityFrm")
        Dim International As String = Request.Form("InternationalFrm")
        Dim TravelPoint As Integer = Request.Form("_ctl5:dsTravelPointDD")

            If IsNothing(International) Then
                aInternational = "0"
            Else
                aInternational = "1"
            End If

            Dim AdminTravelPoints As New Devotion2Motion.AdminComp()
            ' Select the country dropdown list
           
AdminTravelPoints.AddStation(Station, Type, Address1, Address2, City,
aInternational, TravelPoint)
               
        End If
       
        Dim ReadResultTable As New Devotion2Motion.AdminComp()
        ' Select the country dropdown list
        dsResultSet.DataSource = ReadResultTable.GetStationtbl()
        dsResultSet.DataBind()
       
    End Sub

</script>


<!-- This UserControl Pulls in the header UserControl and the Div Tag Positions it #css reffrence is TopControl -->
<Div Class="TopControl">
    <UserContol:D2MHeader runat="server"/>
</Div>

<form method="post" action="AdminTravelPoint.aspx" runat="server">
<Div Class="CentreControl">
<table border="0">
<tr>
    <td>
        <asp:Label Text="Station Name: " CssClass="BodyStyle" runat="server"/>
    </td>
    <td>
        <asp:TextBox ID="StationFrm" CssClass="PrimaryGrid" runat="server"/>
    </td>
<tr>
<tr>
    <td>
        <asp:Label Text="Type: " CssClass="BodyStyle" runat="server"/>
    </td>
    <td>
        <asp:TextBox ID="TypeFrm" CssClass="PrimaryGrid" runat="server"/>
    </td>
<tr>
<tr>
    <td>
        <asp:Label Text="Address1: " CssClass="BodyStyle" runat="server"/>
    </td>
    <td>
        <asp:TextBox ID="Address1Frm" CssClass="PrimaryGrid" runat="server"/>
    </td>
<tr>
<tr>
    <td>
        <asp:Label Text="Address2: " CssClass="BodyStyle" runat="server"/>
    </td>
    <td>
        <asp:TextBox ID="Address2Frm" CssClass="PrimaryGrid" runat="server"/>
    </td>
<tr>
<tr>
    <td>
        <asp:Label Text="City: " CssClass="BodyStyle" runat="server"/>
    </td>
    <td>
        <asp:TextBox ID="CityFrm" CssClass="PrimaryGrid" runat="server"/>
    </td>
<tr>
<tr>
    <td>
        <asp:Label Text="International: " CssClass="BodyStyle" runat="server"/>
    </td>
    <td>
        <asp:CheckBox ID="InternationalFrm" CssClass="PrimaryGrid" runat="server"/>
    </td>
<tr>
</tr>
    <td>
        <asp:Label Text="Travel Point: " CssClass="BodyStyle" runat="server"/>
    </td>
    <td>
        <UserContol:TravelPointDD runat="server"/>
    </td>
<tr>
</tr>
    <td>&nbsp;
       
    </td>
    <td>
        <input value="Submit" type="submit">
    </td>
</tr>
</table>
</Div>

<asp:DataGrid ID="dsResultSet" AutoGenerateColumns="False" CssClass="PrimaryGrid" ShowHeader="true" runat="server">
<Columns>
    <asp:BoundColumn DataField="StationID" ReadOnly="true" HeaderText="Station ID"/>
    <asp:BoundColumn DataField="Station" ReadOnly="true" HeaderText="Station"/>
    <asp:BoundColumn DataField="Type" ReadOnly="true" HeaderText="Type"/>
    <asp:BoundColumn DataField="Address1" ReadOnly="true" HeaderText="Address"/>
    <asp:BoundColumn DataField="Address2" ReadOnly="true" HeaderText="&nbsp;"/>
    <asp:BoundColumn DataField="City" ReadOnly="true" HeaderText="City"/>
    <asp:BoundColumn DataField="International" ReadOnly="true" HeaderText="International"/>
    <asp:BoundColumn DataField="TravelPoint" ReadOnly="true" HeaderText="City"/>
</Columns>
</asp:DataGrid>

</form>


<Div Class="CenterControl">
    <UserContol:D2MFooter runat="server"/>
</Div>


##the vb componet that passess to the sql query ##

Public Function AddStation(ByVal Station As String, ByVal Type As
String, ByVal Address1 As String, ByVal Address2 As String, ByVal City
As String, ByVal aInternational As Integer, ByVal TravelPoint As
Integer) As SqlDataReader

            ' Create Instance of Connection and Command Object
            Dim
myConnection As New
SqlConnection(ConfigurationSettings.AppSettings("strConn"))
            Dim
myCommand As New SqlCommand("sp_call_Station_Insert", myConnection)

            ' Mark the Command as a SPROC
            myCommand.CommandType = CommandType.StoredProcedure

            ' Add Parameters to SPROC
            Dim
parameterStation As New SqlParameter("@Station", SqlDbType.NVarChar, 50)
            parameterStation.Value = Station
            myCommand.Parameters.Add(parameterStation)
           
            ' Add Parameters to SPROC
            Dim
parameterType As New SqlParameter("@Type", SqlDbType.NVarChar, 50)
            parameterType.Value = Type
            myCommand.Parameters.Add(parameterType)
           
            ' Add Parameters to SPROC
            Dim
parameterAddress1 As New SqlParameter("@Address1", SqlDbType.NVarChar,
50)
            parameterAddress1.Value = Address1
            myCommand.Parameters.Add(parameterAddress1)

            ' Add Parameters to SPROC
            Dim
parameterAddress2 As New SqlParameter("@Address2", SqlDbType.NVarChar,
50)
            parameterAddress2.Value = Address2
            myCommand.Parameters.Add(parameterAddress2)

            ' Add Parameters to SPROC
            Dim
parameterCity As New SqlParameter("@City", SqlDbType.NVarChar, 50)
            parameterCity.Value = City
            myCommand.Parameters.Add(parameterCity)

            ' Add Parameters to SPROC
            Dim
parameteraInternational As New SqlParameter("@aInternational",
SqlDbType.Int, 4)
            parameteraInternational.Value = aInternational
            myCommand.Parameters.Add(parameteraInternational)

            ' Add Parameters to SPROC
            Dim
parameterTravelPoint As New SqlParameter("@TravelPoint", SqlDbType.Int,
4)
            parameterTravelPoint.Value = TravelPoint
            myCommand.Parameters.Add(parameterTravelPoint)

            ' Execute the command
            myConnection.Open()
           
            ## Dim result As SqlDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)

            ' Return the datareader
            Return result

    End Function


## The sql stored procedure ##

CREATE PROCEDURE [dbo].[sp_call_Station_Insert]
(
@Station As nVarChar(50),
@Type As nVarChar(50),
@address1 As nVarChar(50),
@address2 As nVarChar(50),
@City As nVarChar(50),
@aInternational As nVarChar(50),
@TravelPoint As Int
)
AS


DECLARE @ConVale As nVarChar(50)

SET @ConVale = (SELECT Station FROM tblStation WHERE @Station = Station)

If @ConVale = @Station
   
    BEGIN
        SELECT * FROM tblStation
    END
ELSE
    BEGIN
        insert into tblStation
            (Station, Type, address1, address2, city, International, TravelPoint)
        values (@Station, @Type, @address1, @address2, @City, @aInternational, @TravelPoint)
        SELECT * FROM tblStation

    END
GO

View 1 Replies View Related

Insert Values And Selected Items

Oct 2, 2007

Can this be done?
I have a procedure where I have Values and Selected Table items that have to be inserted into a nother table that require them to be stored in the same record to the data correctly placed?
 

View 1 Replies View Related

Insert Multiple Items From An ArraryList Into Db

Jan 4, 2008

HiI am working on a site right now. Basicly how it works is they choose from a list of checkboxes what they want to be quized on. This all gets stored in an arrayList. Once they done that they have an option to save there settings so they don't have to go through the list and choose everything again if they want to come back and do that same quiz. So I am trying to take all those options in the arrayList and put them into the database. So I have 4 questions. Question 1.This is how I was thinking my database design should be.This table that all this stuff is going to be inserted into is called QuickLinks. Originally I was thinking of having a PK to FK relationship with the Asp membership table called Membership(or User Table was another posibility). I am now thinking that is a waste of time and pointless. My first reasoning was well this way I can get the UserID from that table but now I realize no I actually need the UserID to be in the QuickLink table before I try to join the two tables together. With joining the 2 tables I don't get anything out of it since if I just do a check if the User is logged in before I insert the data into the database I can just slip the userID in there as well. Then the QuickLink table should have everything it needs. So My question is I am thinking of having the quick Link talbe to operate like this. Say you have 50 items in the array(this is all from the same item). Each item will gets its own row that will have the UserID,CharacterName,CharacterImagePath, QuickLinkName plus the LinkID.So when I need to call that information I just have to look at 2 pieces of information. Find all the rows that have the same QuickLink name and UserID. So is this a good way to store the data? Question 2.Currently right now I have UserID as unquieIdentifer but  I am guessing if I have 50 rows with  the  same UserID  it won't like that very much since its not Unquie. Should I just change that to a varChar?LinkID      UserID                                                                                               CharacterName CharacterImagePath----------- ---------------------------------------------------------------------------------------------------- ------------- --------------------------------------------------1           15bde69a-c6fe-4159-b60f-405a013ae4c3                                                                 hi            image2           15bde69a-c6fe-4159-b60f-405a013ae4e2                                                                 hi            image3           15bde69a-c6fe-4159-b60f-405a013ae4c3                                                                 hi            imageFind it actually kinda weird that it allowed 2 of the same UserIDs in. Question 3.Right now my primary key is LinkID. I just made that up but right now I have no use for it since I can't think of anything that would be useful to be a primary key but I figured I need a primary key. So does anyone have any ideas if I should leave that as the primary key or not have one? Or what I should do?Question 4I been playing around on a new webpage I made so I don't have so much cludder code to get in the way I don't screw anything up(I just find it sometimes easier to make a watered down version of what I want and get that work before I tackle the big version and have no clue what is going on. I am not sure if this is the best approach). So right now I  have text box that I type in the UserID into(I have gotten  the part to work where it checks the login  of the user and grabs it but  I don't want use it for now since it might complicate things a bit).I have then a textbox where you type in the image path and then 2 other textboxes that you type in the characterName. Those 2 textBoxes for the characterName gets stored in array(so it is almost like the real thing I want to do). I then tired to put my code in a for loop and tired to keep inserting it in until everything from the array was out. However it does not work. I get this errorThe variable name '@UserID' has already been declared. Variable names must be unique within a query batch or stored procedure. I am not sure what it means or wants.  My code. ArrayList InsertCharcter = new ArrayList();
InsertCharcter.Add(TextBox1.Text);
InsertCharcter.Add(TextBox2.Text);

SqlCommand comm;
string holdInsert = "INSERT INTO QuickLinks (UserID, CharacterName, CharacterImagePath) VALUES (@UserID,@CharacterName,@CharacterImagePath)";
comm = new SqlCommand(holdInsert, getConnection());
Guid userID = new Guid(txtuserID.Text);


comm.Connection.Open();
for (int i = 0; i < InsertCharcter.Count; i++)
{
comm.Parameters.Add("@UserID", SqlDbType.VarChar);
comm.Parameters["@UserID"].Value = txtuserID.Text;
comm.Parameters.Add("@CharacterName", SqlDbType.VarChar);
comm.Parameters["@CharacterName"].Value = InsertCharcter[i].ToString();
comm.Parameters.Add("@CharacterImagePath", SqlDbType.VarChar);
comm.Parameters["@CharacterImagePath"].Value = txtImage.Text;

comm.ExecuteNonQuery();         }        comm.Connection.Close();  Thanks

View 2 Replies View Related

Insert Items From One To Table To Multiple Smaller Tables

Nov 15, 2004

I have a table that I filled with data imported from another database.

What I need to do is now take this huge table and break apart the information and put it into 5 smaller tables.

So I have a huge insert statement.

I have one main table called Property with two keys. One key is a "Prop_ID" and the other is "owner" where Prop_Id is a automated unique ID. Once the information is inserted into that table, I then get the Unique ID that it was given, and I then used that ID to insert into the other tables.

The problem I am encountering is I keep getting the following error

Violation of PRIMARY KEY constraint 'PK_Prop_Res_Detail'. Cannot insert duplicate key in object 'Prop_Res_Detail'.
The statement has been terminated.

I have an idea what might be going wrong, but I am not sure. What I want to happen is that I want the query to look at the first row of the huge table and then do all 4 of the inserts, and then go to the next row. But I think it is trying to all the inserts into the property table, and then go on to the Prop_Res_Detail table and that is why I am getting that error.

Any help is greatly appreicated.

here is the code..


Code:

CREATE PROCEDURE [dbo].[Insert_Properties]

AS

DECLARE @Prop_ID Int

SET NOCOUNT ON

INSERT INTO Property(Acres,
Assoc_Phone,
Assoc_Cell,
AppraisalForm,
Area,
Assess_Account,
AttachDetach,
Block,
City,
County,
Directions,
DOM,
ER_EA,
FloodZone,
Import_From,
Import_ID,
Insert_Date,
LandSQFT,
LandSQFTDim,
LegalRemarks,
ListAppraiser_ID,
ListAssoc_ID,
ListBroker_ID,
ListDate,
Listing_Office_Remarks,
ListPrice,
Lot,
Map,
Num_Images,
Office_Phone,
Original_ListPrice,
Owner,
Pending_Date,
PhotoName,
PropSubType,
Prop_Type,
Quad,
Remarks,
State,
Status,
StreetDir,
StreetNum,
StreetName,
Township,
UnitNumber,
ZipCode)

SELECT CONVERT(FLOAT(8), Acres),
CONVERT(Varchar(25), Assoc_Phone),
CONVERT(Varchar(25),Assoc_Cell),
CONVERT(Varchar(50), AppraisalForm),
CONVERT(Varchar(10), Area),
CONVERT(Varchar(50), Assess_Account),
CONVERT(Varchar(20), AttachDetach),
CONVERT(Varchar(20), Block),
CONVERT(Varchar(40), City),
CONVERT(Varchar(50), County),
CONVERT(Varchar(1000), Directions),
CONVERT(int, DOM),
CONVERT(Varchar(10), ER_EA),
CONVERT(Varchar(50), FloodZone),
CONVERT(Varchar(20), Import_From),
CONVERT(Varchar(20), Import_ID),
CONVERT(datetime, Insert_Date, 101),
CONVERT(Varchar(20), LandSQFT),
CONVERT(Varchar(50), LandSQFTDim),
CONVERT(Varchar(2000), LegalRemarks),
CONVERT(Varchar(50), ListAppraiser_ID),
CONVERT(Varchar(50), ListAssoc_ID),
CONVERT(Varchar(50), ListBroker_ID),
CONVERT(varchar(11), ListDate),
CONVERT(Varchar(1000), Listing_Office_Remarks),
CONVERT(Varchar(10), ListPrice),
CONVERT(Varchar(20), Lot),
CONVERT(Varchar(10), Map),
CONVERT(Varchar(10), Num_Images),
CONVERT(Varchar(25), Office_Phone),
CONVERT(Varchar(10), Original_ListPrice),
CONVERT(Varchar(50), Owner),
CONVERT(datetime, Pending_Date, 101),
CONVERT(Varchar(50), PhotoName),
CONVERT(Varchar(25), PropSubType),
CONVERT(Varchar(20), Prop_Type),
CONVERT(Varchar(10), Quad),
CONVERT(Varchar(1000), Remarks),
CONVERT(Varchar(25), State),
CONVERT(Varchar(10), Status),
CONVERT(Varchar(4), StreetDir),
CONVERT(Varchar(15), StreetNum),
CONVERT(Varchar(50), StreetName),
CONVERT(Varchar(20), Township),
CONVERT(Varchar(6), UnitNumber),
CONVERT(Varchar(20), ZipCode )

FROM Imported_Closed_Property_From_MLS


SET @Prop_ID = @@Identity

/*Property Res Table */
INSERT INTO Prop_Res_Detail(Prop_ID,
Addition,
Appliances,
Basement_Area,
BasementDesc,
Builder,
Construction,
Cool,
Dining,
District_School,
Energy,
Exterior_Features,
Fence,
Floors,
Foundation,
FP,
FP_Type,
Garage_Attach_Detach,
Garage_Cap,
Handicap,
Heat,
HOA,
HOA_Fee,
HOA_Inc,
HOA_Period,
Inlaw_Plan,
Interior_Features,
Livestock,
Lot_Desc,
Mechanical,
NumLivingArea,
Num_Baths,
Num_Beds,
Num_Levels,
Other_Info,
OvenDesc,
Owner,
Parking,
Patio,
Patio_Dim,
Perc_Basement_Com,
Pool,
Pool_Type,
Prop_Faces,
Range,
RangeDesc,
Remodeled,
Rental,
RentalAmount,
Roof_Type,
Roof_Year,
RoomOther,
Sect,
SQFT,
SQFTSource,
Style,
Tax_Amount,
Tot_Rooms,
UtilityAvailable,
WindowType,
Year_Built)

SELECT @Prop_ID,
CONVERT(Varchar(50), Addition),
CONVERT(Varchar(100), Appliances),
CONVERT(Varchar(25), Basement_Area),
CONVERT(Varchar(100), BasementDesc),
CONVERT(Varchar(50), Builder),
CONVERT(Varchar(50), Construction),
CONVERT(Varchar(20), Cool),
CONVERT(Varchar(10), Dining),
CONVERT(Varchar(60), District_School),
CONVERT(Varchar(100), Energy),
CONVERT(Varchar(100), Exterior_Features),
CONVERT(Varchar(40), Fence),
CONVERT(Varchar(100), Floors),
CONVERT(Varchar(40), Foundation),
CONVERT(Varchar(50), FP),
CONVERT(Varchar(40), FP_Type),
CONVERT(Varchar(50), Garage_Attach_Detach),
CONVERT(Varchar(25), Garage_Cap),
CONVERT(Varchar(20), Handicap),
CONVERT(Varchar(20), Heat),
CONVERT(Varchar(40), HOA),
CONVERT(Varchar(30), HOA_Fee),
CONVERT(Varchar(100), HOA_Inc),
CONVERT(Varchar(20), HOA_Period),
CONVERT(Varchar(20), Inlaw_Plan),
CONVERT(Varchar(100), Interior_Features),
CONVERT(Varchar(40), Livestock),
CONVERT(Varchar(400), Lot_Desc),
CONVERT(Varchar(100), Mechanical),
CONVERT(Varchar(10), NumLivingArea),
CONVERT(Varchar(5), Num_Baths),
CONVERT(Varchar(5), Num_Beds),
CONVERT(Varchar(30), Num_Levels),
CONVERT(Varchar(100), Other_Info),
CONVERT(Varchar(100), OvenDesc),
CONVERT(Varchar(50), Owner),
CONVERT(Varchar(100), Parking),
CONVERT(Varchar(25), Patio),
CONVERT(Varchar(50), Patio_Dim),
CONVERT(Varchar(25), Perc_Basement_Com),
CONVERT(Varchar(20), Pool),
CONVERT(Varchar(20), Pool_Type),
CONVERT(Varchar(40), Prop_Faces),
CONVERT(Varchar(20), Range),
CONVERT(Varchar(100), RangeDesc),
CONVERT(Varchar(50), Remodeled),
CONVERT(Varchar(10), Rental),
CONVERT(Varchar(10), RentalAmount),
CONVERT(Varchar(20), Roof_Type),
CONVERT(Varchar(5), Roof_year),
CONVERT(Varchar(100), RoomOther),
CONVERT(Varchar(10), Sect),
CONVERT(Varchar(10), SQFT),
CONVERT(Varchar(50), SQFTSource),
CONVERT(Varchar(100), Style),
CONVERT(Varchar(10), Tax_Amount),
CONVERT(Varchar(5), Tot_Rooms),
CONVERT(Varchar(100), UtilityAvailable),
CONVERT(Varchar(50), WindowType),
CONVERT(Varchar(5), Year_Built)
FROM Imported_Closed_Property_From_MLS

/*Sold Info Table */
INSERT INTO Sold_Info(Prop_ID,
Buy_Pts,
Closed_Date,
Closed_Price,
Closed_Price_SQFT,
COOP_Sales,
Days_On_Market,
InterestRate,
Lender,
LoanAmount,
LoanTerms,
Loan_Years,
Origination_Fee,
Owner,
SellerConcessions,
LoanType,
Sold_Remarks)

SELECT @Prop_ID,
CONVERT(Varchar(10), Buy_Pts),
CONVERT(datetime, Closed_Date, 101),
CONVERT(Varchar(10), Closed_Price),
CONVERT(Varchar(50), Closed_Price_SQFT),
CONVERT(Varchar(50), COOP_Sales),
CONVERT(Varchar(5), DOM),
CONVERT(Varchar(10), InterestRate),
CONVERT(Varchar(50), Lender),
CONVERT(Varchar(10), LoanAmount),
CONVERT(Varchar(50), LoanTerms),
CONVERT(Varchar(10), Loan_Years),
CONVERT(Varchar(10), Origination_Fee),
CONVERT(Varchar(50), Owner),
CONVERT(Varchar(100), SellerConcessions),
CONVERT(Varchar(25), LoanType),
CONVERT(Varchar(1000), Sold_Remarks)
FROM Imported_Closed_Property_From_MLS

/*Remarks Table */
INSERT INTO Remarks(Prop_ID,
App_Date,
App_Remark,
Contract_Date,
Inspection_Type,
Owner,
PendingSalesPrice,
PendingSaleComments)

SELECT @Prop_ID,
CONVERT(datetime, App_Date, 101),
CONVERT(Varchar(1000), App_Remark),
CONVERT(datetime, Contract_Date, 101),
CONVERT(Varchar(50), Inspection_Type),
CONVERT(Varchar(50), Owner),
CONVERT(Varchar(10), PendingSalesPrice),
CONVERT(Varchar(1000), PendingSaleComments)
FROM Imported_Closed_Property_From_MLS

GO

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved