Table To Repopulate A Form

Feb 25, 2006

Making a form where a patient will fill out check boxes and after submission would like to present their submitted form back if they choose the option and be able to edit the data entered. What I am wanting to do is repopulate the form, but the checkboxes will need a database with this information that will then go to a php script and take the values entered into the various checkboxes and check those values from the database that were entered origionally. So lets say the database haspid - int(5) auto_increment primary keypatient_first - varchar(30) first namepatient_last - varchar(50) last namearthritis - bool or what?copd - bool or what?tin ear -bool or what?What would be the best to check against to repopulate does a true false make sense or should it either be NULL or the actual condition (just kidding about the tin ear)?

View 1 Replies


ADVERTISEMENT

SQL Server 2005 - FTS - Repopulate After Migration

Sep 25, 2007

I have Restored database from SQL server 2000 to SQL server 2005 and found that Full Text catalogs are not Populated.

I tried using, exec sp_fulltext_catalog 'CatalogName', 'start_full' and it showed the message
"Warning: Request to start a full-text index population on table or indexed view 'dbo.Corpora' is ignored because a population is currently active for this table or indexed view."

Please let me know on "How to Repopulate all the Full text catalogs"

Thanks.

View 1 Replies View Related

Need Help W/ Postback To 'Customers' Table On Form Using Select Query From 'Parameters' Table

Dec 20, 2007

I have set up a 'Parameters' table that solely stores all pre-assigned selection values for a webform. I customized a stored query to Select the values from the Parameters table. I set up the webform. The result is that the form1.apsx automatically populates each DropDownList task with the pre-assigned values from the 'Parameters' table (for example, the stored values in the 'Parameters' table 'Home', 'Business', and 'Other'  populate the drop down list for 'Type').
The programming to move the selected data from form1.aspx to a new table in the SQL database perplexes me. If possible, I would like to use the form1.aspx to Postback (or Insert) the "selected" data to a *new* column in a *new* table (such as writing the data to the 'CustomerType' column in the 'Customers' table; I clearly do not want to write back to the 'Parameters' table). Any help to get over this hurdle would be deeply appreciated.

View 1 Replies View Related

Update One Table Form Another Table From Different Database And Server

Sep 1, 2015

I need to update the AcquiredFrom table from source_office table. both the tables are from different database and server. we can match them on Code and source code. Initially if we can find out the discrepancies and then how can we fix them. Also there might be some dealerships that would have to be added to acquiredfrom table from the source_office table if they are not there already.

Table 1 (AcquiredFrom) database (Service) Server(FS3)
Select Code, Name, ContactName, AddLine1, AddLine2, city, state, zip, PhoneNumber
FROM [dbo].[AcquiredFrom]
Order by Code
Table 2 (source_office) database (DCP_PROD) Server (DPROSQL)
Select source_code, name, addr1, addr2, city, state_id, zip, phone FROM [dbo].[source_office]
order by source_code

View 9 Replies View Related

One Form To Update Different SQL Tables Based Upon Form Selection

Apr 16, 2008

Hello,
My company Intranet has a form that agents can use to post their comments about the company to upper management, but our customer service department would like to modify the form so that the agent has to pick from a comment type.
The dropdown options on the form will be as follows:
ComplimentsComplaintsGeneral CommentsSuggestions
Each dropdown option has a designated table in a SQL DB.Using postback on the same page, I need to change which fields of the form are visible based upon which dropdown selection the user chooses, and I need the fields to then be inserted into the table that corresponds with the dropdown selection item.
For example: If the Compliments dropdown selection is picked, I need a text box to show for the user's location, the name of the customer, account number, and the message box. Once the submit button is clicked, the characters in these boxes need to be inserted into the Compliments table using its data adapter.
However, if the user selects Suggestions, the name of the customer and the account number should not be visible, since these fields do not exist and when the submit button is pressed, the Suggestions table should be updated.
If you need more information, I will provide whatever is needed.
As always, thanks for everyone's assistance.
Chris

View 3 Replies View Related

Moving One Table Form One DB To Another

May 8, 2014

Wondering if its possible to copy a table form one DB and paste to another dB? is there a tool for that?

View 7 Replies View Related

Determine If Autoincrement Is Set In A Table, Form Asp.net

Nov 15, 2006

I want to access sqlserver table properties from asp.net .How do i know that a table defined in sqlserver has autoincrement field or not.Actually i have to access all the tables in a database and execute different function for table with auto increment on and off.
I am not being able identify this property from codes.Please help.thank you

View 6 Replies View Related

Using A Web Form To Append A Record To A SQL Table

Dec 30, 2006

How to I make it so that a Authenticated User to a website can append a record to a SQL table.  I have watched the video on the asp.net website about using database on a web, it shows how to allow a user to change a record in a database, but nothing I have seen so far shows how they can append a record.
 
What I am trying to do:  I am building a website for a ATV club using Visual Studio 2005 and c#.  I am setting up users or members on the site (club members will have a user account, while all others will be un-authenticated users.  I am setting up a classifieds area where members can post items for sale, items they are looking for, etc. 
 
I am planning to use roles to allow authenticated users access to a webpage located in a restricted directory.  There I want to place a XHTML page which would allow the users to post their classified ads for free.  I will have another page that will allow everyone to view the ads not just club members.  I want to make this as easy to maintain as possible.   I don’t plan on having all the postings come through me to be placed on the web, I want it all automated. 

View 2 Replies View Related

Form To Subtract An Amount From A Table On Sql.

Mar 29, 2008

Hi Guys,
Does anyone have a good example how to subtract an amount from an sql table?
At present i have a table such as this


id

View 2 Replies View Related

Unable To Update SQL Table From A Web Form

Jan 20, 2006

I have a Table which stores data from two different databases. To update it I made a Web Form that opens a single record where you can edit the data (using TextBox). Then there is an Update Button, which is supoused to Update that record in the SQL Database. However, for some reason it does not work. I get no error and every thing seems to work fine, but the data is not updated. When running the same UPDATE statment in the SQL Query Analyzer everything works just fine. Here is the code for the button click (For test purpose I've set a spesific record to update the Task cell to "Test" and I've adde a DataGrid to be able to see if something is happening):
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Dim objConnection As SqlConnection
Dim objDataAdapter As SqlDataAdapter
Dim objDataSet As DataSet
Dim objDataView As DataView
Dim strConnect As String
Dim strSQL As String
Dim strUpdate As String
strConnect = "Persist Security Info=False;Integrated Security=SSPI;server=SRV01;database=DB1"
strSQL = "SELECT * FROM Users WHERE UserID ='" & Request.QueryString("UserID") & "'"
strUpdate = "UPDATE Users SET Task = 'Test' WHERE UserID = 36"     '" & Request.QueryString("UserID") & "'"
objConnection = New SqlConnection(strConnect)
objDataAdapter = New SqlDataAdapter(strSQL, objConnection)
objDataAdapter.UpdateCommand = New SqlCommand(strUpdate)
objDataSet = New DataSet
objDataAdapter.Fill(objDataSet, "User")
objDataView = New DataView(objDataSet.Tables("User"))
dgrTest.DataSource = objDataView
dgrTest.DataBind()
objDataAdapter.ContinueUpdateOnError = True
Try
objDataAdapter.Update(objDataSet, "User")
lblTest.Text = objDataAdapter.UpdateCommand.CommandText
Catch ex As Exception
lblTest.Text = "Error"
End Try
End Sub
 
Thank you for your much needed help in advance.
 

View 3 Replies View Related

Select Form Table And Exclude Another

Mar 18, 2005

Hello,

I've a query wich with I select buildings form a table.
I've a second table with a few building I don't want in my select (exclude form select).
How can I make this?

Thx a lot.
Dom

PS: I'm a sql newbie...

View 2 Replies View Related

Select Form 1 Table And Insert Into Another

Jan 30, 2004

Can someone point me in the right direction or show me a sample that may assist me in the following.

Thanks,
-dw


I need to select some data from 1 table and insert it into another using a stored procedure.

I also would like to select data from table 1 and insert a new record into table 1 modifying a field with new data passed by parameter.

Is it something like:

parameters passed = @selectJobNumber, @newJobNumber


declare @DeliveryMethodIDint

SELECT
@DeliveryMethodID=DeliveryMethodID,
... etc - more fields

FROM
jobDeliveryAddress

WHERE
(JobNumber= @selectJobNumber)


INSERT INTO [jobDeliveryAddress]
(
[JobNumber],
[DeliveryMethodID],
... etc - more fields

)
VALUES
(
@newJobNumber,
@DeliveryMethodID,
... etc

)

View 2 Replies View Related

Select Form 1 Table And Insert Into Another

Jan 30, 2004

Can someone point me in the right direction or show me a sample that may assist me in the following.

Thanks,
-dw


I need to select some data from 1 table and insert it into another using a stored procedure.

I also would like to select data from table 1 and insert a new record into table 1 modifying a field with new data passed by parameter.

Is it something like:

parameters passed = @selectJobNumber, @newJobNumber


declare @DeliveryMethodIDint

SELECT
@DeliveryMethodID=DeliveryMethodID,
... etc - more fields

FROM
jobDeliveryAddress

WHERE
(JobNumber= @selectJobNumber)


INSERT INTO [jobDeliveryAddress]
(
[JobNumber],
[DeliveryMethodID],
... etc - more fields

)
VALUES
(
@newJobNumber,
@DeliveryMethodID,
... etc

)

View 6 Replies View Related

How To Import Updated Table Form One DB To Another

Jan 13, 2014

I have a table called diagnosis_status in my TestdB environment and want to import the same table into my production (PROD) dB. This table also exist in PROD but I have update the one in Test dB and want to import the updated one into PROD?is there such copy/paste tools? I don't see it in my management studio?

View 4 Replies View Related

I'm Not Able To Insert Data From A Form Into A Database Table

Feb 18, 2007

Hello.  As the subject heading says, I'm not able to insert data typed into the contact form on my page into a database table.  I'm using an SqlDataSource object.  Here's the code for this page:
 
<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><%@ Page Language="VB" Debug="True" Explicit="True" ContentType="text/html" ResponseEncoding="iso-8859-1" %><%@ Import Namespace="System.Data" %><%@ Import Namespace="System.Data.Odbc" %><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head><body><div align="center">  <asp:label ID="label1" runat="server" Font-Name="Arial" Font-Size="24" ForeColor="#00FF00" /></div><div align="center">  <asp:label ID="label2" runat="server" Font-Name="Verdana" Font-Size="18" ForeColor="#0000FF" /></div><form runat="server" id="new_form">  <table width="50%" border="1" align="center" id="form_table">    <tr>       <td nowrap="nowrap">         <asp:label Font-Bold="true" Font-Size="10" runat="server" Font-Name="CarlysHand" Text="First Name" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("FirstName") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="15" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="first" TabIndex="1" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="first" Type="String" ErrorMessage="Please enter your first name." Display="Dynamic" /> </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Middle Initial" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("MI") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="1" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="mi" TabIndex="2" /></td>    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Last Name" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("LastName") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="18" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="last" TabIndex="3" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="last" Type="String" ErrorMessage="Please enter your last name." Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Number & Street" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("NoAndStreet") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="40" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="no_and_street" TabIndex="4" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="no_and_street" Type="String" ErrorMessage="Please enter your number and street." Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Unit #" BackColor="#FFE1E1" ForeColor="#FF0000" />      </td>      <td><asp:textbox text='<%#Bind("Unit") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="6" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="unit" TabIndex="5" /></td>    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="City" BackColor="#FFE1E1" ForeColor="#FF0000" />      </td>      <td><asp:textbox text='<%#Bind("City") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="20" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="city" TabIndex="6" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="city" Type="String" ErrorMessage="Please enter your city." Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="State" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("State") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="2" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="state" TabIndex="7" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="state" ErrorMessage="Please enter your state." Type="String" Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Zip Code" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("ZipCode") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="5" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="zip" TabIndex="8" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="zip" ErrorMessage="Please enter your zip code." Type="Integer" Display="Dynamic" />   <asp:regularexpressionvalidator Display="Dynamic" runat="server" ValidationExpression="[0123456789]{5}" ControlToValidate="zip" ErrorMessage="Please enter a valid US Zip Code" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Phone #" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("PhoneNumber") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="10" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="phone" TabIndex="9" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="phone" ErrorMessage="Please enter your phone number." Type="Double" Display="Dynamic" />      <asp:rangevalidator runat="server" ControlToValidate="phone" MinimumValue="2002000000" MaximumValue="9999999999" Type="Double" ErrorMessage="Please enter a valid US Phone Number." Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Email" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("Email") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="40" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="email" TabIndex="10" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="email" ErrorMessage="Please enter your email address." Type="String" Display="Dynamic" />      <asp:regularexpressionvalidator runat="server" ControlToValidate="email" ErrorMessage="Please enter a valid email address." ValidationExpression=".*@.{2,}..{2,}" Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Username" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox text='<%#Bind("Username") %>' BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="12" TextMode="SingleLine" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="username" TabIndex="11" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="username" ErrorMessage="Please enter your username." Type="String" Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Password" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td> <asp:textbox text='<%#Bind("Password") %>' Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="12" TextMode="Password" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="password" TabIndex="12" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="password" ErrorMessage="Please enter your password." Type="String" Display="Dynamic" />    </tr>    <tr>       <td nowrap="nowrap">         <asp:label Font-Size="10" Font-Bold="true" runat="server" Font-Name="CarlysHand" Text="Confirm Password" BackColor="#FFE1E1" ForeColor="#FF0000" /></td>      <td><asp:textbox Font-Size="10" BorderColor="#BF0000" BorderStyle="Groove" BorderWidth="2" BackColor="#FFCCFF" ForeColor="#FF0000" Columns="12" TextMode="Password" Font-Bold="true" Font-Name="CarlysHand" runat="server" ID="confirm" TabIndex="13" /></td>      <asp:requiredfieldvalidator runat="server" ControlToValidate="confirm" ErrorMessage="Please confirm your password." Type="String" Display="Dynamic" />      <asp:comparevalidator runat="server" ControlToValidate="confirm" ControlToCompare="password" Type="String" ErrorMessage="Please input matching passwords." Display="Dynamic" />    </tr>    <tr>       <td colspan="2" align="center" nowrap="nowrap"><asp:linkbutton BorderColor="#0000FF" BorderWidth="3" BorderStyle="Dotted" ToolTip="Click me!" Text="Submit" Font-Name="CarlysHand" Font-Size="15" Font-Bold="true" BackColor="#CCCCCC" ForeColor="#FF0000" runat="server" ID="submit" TabIndex="14" /></td>    </tr>  </table>   <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="driver={MySQL ODBC 3.51 Driver};server=mysql01.discountasp.net; data source=bkfwebdesi1_mysqlConn;database=MYSQLDB_316823;uid=bkfwebdesi1; password=bkf2065" ProviderName="System.Data.Odbc"   InsertCommand="INSERT INTO ContactInfo VALUES (?, ?, ?, ?, ?, ?, ?, ?,       ?, ?, ?, ?, ?)">     <InsertParameters>  <asp:Parameter Name="ContactID" Type="Int32" />  <asp:Parameter Name="FirstName" Type="String" />  <asp:Parameter Name="MI" Type="String" />  <asp:Parameter Name="LastName" Type="String" />  <asp:Parameter Name="NoAndStreet" Type="String" />  <asp:Parameter Name="Unit" Type="String" />  <asp:Parameter Name="City" Type="String" />  <asp:Parameter Name="State" Type="String" />  <asp:Parameter Name="ZipCode" Type="Int32" />  <asp:Parameter Name="PhoneNumber" Type="String" />  <asp:Parameter Name="Email" Type="String" />  <asp:Parameter Name="Username" Type="String" />  <asp:Parameter Name="Password" Type="String" /> </InsertParameters>  </asp:SqlDataSource></form></body></html>
 
Thanks in advance for your help in this matter!
 
Brian

View 1 Replies View Related

Inserting/ Updating More Than One Table From A Single Web Form

Apr 22, 2008

 i wanted to ask how to insert values from a single web form into two sql tables, i have been looking and the visual web developer i use doesnt seam to allow me to even atempt it i've tried selecting all the values from two different tables and then adding those two tables to an insert function but it doesnt work likewise the update functioni have values in a table currently a reference number and i want to use this reference number to update the address values in this table so update this field.table1 and thisfield.table2 when ref number = @ refnumber the reference number is present in both tables and is linked PK to FK  <asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:Back End DataConnectionString %>"
SelectCommand="SELECT StartDetails.StartDetailsID, StartDetails.ContractIDNo, StartDetails.ContractName, StartDetails.NINO, StartDetails.AnticipatedStartDate, StartDetails.StartDateTime, StartDetails.StartDateLetterSent, StartDetails.StartDate, StartDetails.AnticipatedEndDate, StartDetails.ActualEndDate, StartDetails.ReasonForLeaving, StartDetails.Provider, StartDetails.AdviserReferrer, StartDetails.ProvisionCat, StartDetails.Provision, ClientDetails.NINO AS Expr1, ClientDetails.CentreNo, ClientDetails.FirstName, ClientDetails.SecondName, ClientDetails.AddressLine1, ClientDetails.AddressLine2, ClientDetails.PostCode, ClientDetails.ContactTelephoneNumber, ClientDetails.MobileNo, ClientDetails.Email, ClientDetails.DateOfBirth, ClientDetails.Gender, ClientDetails.PWD, ClientDetails.Ethnicity, ClientDetails.ClientGroup, ClientDetails.RepeatStartDate, ClientDetails.CaseworkerName, ClientDetails.ClientStatus, ClientDetails.PlacementDates, ClientDetails.JobsearchDay, ClientDetails.AchievedILP, ClientDetails.JobDate, ClientDetails.JobDate2, ClientDetails.JobDate3, ClientDetails.EligibleForRolledUpWeeks, ClientDetails.NoOfWeeksClaimed, ClientDetails.MarketingWhere, ClientDetails.Notes, ClientDetails.JobCentre, ClientDetails.JobCentreRep FROM StartDetails INNER JOIN ClientDetails ON StartDetails.NINO = ClientDetails.NINO WHERE (StartDetails.StartDetailsID = @StartDetailsID) AND (StartDetails.NINO = @NINO)"
InsertCommand="INSERT INTO [StartDetails] ([NINO], [StartDate], [AnticipatedEndDate]) VALUES (@NINO, @StartDate, @AnticipatedEndDate)"

UpdateCommand="UPDATE [StartDetails] SET [StartDate] = @StartDate, [AnticipatedEndDate] = @AnticipatedEndDate WHERE [StartDetailsID] = @StartDetailsID,[NINO] = @NINO">
<SelectParameters>
<asp:QueryStringParameter Direction="InputOutput" Name="StartDetailsID"
QueryStringField="StartDetailsID" />
<asp:QueryStringParameter Direction="InputOutput" Name="NINO"
QueryStringField="NINO" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="StartDate" Type="DateTime" />
<asp:Parameter Name="AnticipatedEndDate" Type="DateTime" />
<asp:Parameter Name="StartDetailsID" Type="Int32" />
<asp:Parameter Name="NINO" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="NINO" />
<asp:Parameter Name="StartDate" Type="DateTime" />
<asp:Parameter Name="AnticipatedEndDate" Type="DateTime" />
</InsertParameters>
</asp:SqlDataSource>   your coinsideration is appreciatedChris  

View 4 Replies View Related

How To Store Bullet-form Description In A Table ?

Apr 24, 2004

Assume that if i have a product called Jacket that has the following descriptions, which written in bullet form

• 600 Denier Carbolex® coated 1000mm Polyurethane
• Anatomically fitted for the riding position
• Ballistic nylon in protective areas
• FS Rainguard® 100% waterproof/breathable jet-liner
• Polyester mesh non-allergenic liner
• Removable CE armour equipped in the hips and knees
• Padding at knees, shin, hips and kidney area
• Removable zip-out satin quilted liner
• Reflective Phoslite®
• Stretch in the knees
• Gusseted with Velcro front zip closure
• Velcro adjustable waist
• 2 front pockets
• Storm flap system


How am i going to store in the Products table ? But not all products have these descriptions, other products may have no description at all.... If I store them in a text/memo DESCRIPTION field, then , I do not know how to format them into bullet form...


I would appreciate anyone knows the solution for me... Thanks in advance !

View 4 Replies View Related

Inputting Random Numbers To Table Column From Web Form

Feb 28, 2007

I'm grappling with this issue which I thought was basic VB programming; I'm trying to insert a random number (between 100 and 999) into a SQL table column (=Status_ID). This is input as part of a user submitting helpdesk requests via a APS.Net Web Form. The 'Status_ID' field is obviously not visible to the user but will help reference this Helpdesk request on the database.Here is the code:Protected Sub submitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submitButton.Click        If Page.IsValid Then            ' Define data objects            Dim conn As SqlConnection            Dim comm As SqlCommand            ' Read the connection string from web.config            Dim connectionString As String = _            ConfigurationManager.ConnectionStrings("ITNet_Students").ConnectionString            ' Initialize connection            conn = New SqlConnection(connectionString)            ' Create command            comm = New SqlCommand( _            "INSERT INTO HelpDesk (First_Name, Last_Name, StudentID, PersonalEmail," & _            "CategoryID, SubjectID, Description, StatusID) " & _            "VALUES (@First_Name, @Last_Name, @StudentID, @PersonalEmail, " & _            "@CategoryID, @SubjectID, @Description, @StatusID)", conn)            ' Use randomize            Randomize()            Dim randomvalue As Integer            ' Generate random value between 999 and 100.            randomvalue = Int((900 * Rnd()) + 100)            ' Add command parameters            comm.Parameters.Add("@First_Name", System.Data.SqlDbType.NVarChar, 50)            comm.Parameters("@First_Name").Value = fnameTextBox.Text            .            .            .            comm.Parameters.Add("@StatusID", System.Data.SqlDbType.Int)            comm.Parameters("@StatusID").Value = randomvalue            'Enclose database code in Try-Catch-Finally            Try                ' Open connection                conn.Open()                ' Execute the command                comm.ExecuteNonQuery()                ' Reload page if the query executed successfully                Response.Redirect("HelpDesk.aspx")            Catch                ' Display error message                dbErrorMessage.Text = _                    "Error submitting the help desk request! Please try again later, and/or change the entered data!"            Finally                'close connection                conn.Close()            End Try        End If    End Sub----------------------------------------------------------------------------------------------------------------------I keep getting the error message under 'Catch'  and the page 'HelpDesk.aspx' is not reloading; the 'comm.ExecuteNonQuery()' is not executing.Can anyone spot any inconsistencies in the declaration of the 'randomvalue' variable?P.S: this code works fine if you replace 'randomvalue' with any integer in 'comm.Parameters("@StatusID").Value = randomvalue' 

View 2 Replies View Related

How To Write SQL To Form New Table From Job Revence And Job Cost Using SQL Statement ? Thx

Dec 7, 2004

Edited by SomeNewKid. Please post code between <code> and </code> tags.


// Pls copy the following HTML after that you generate the HTML page. Then you will know what I mean. I need to form "New Table" from Job Revence and Job Cost using SQL statement? thx



-----------The following code-----------------

<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=big5">
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=Big5">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 9">
<link rel=File-List href="cid:filelist.xml@01C4DA4E.7D08F5E0">
<!--[if !mso]>
<style>
v:* {behavior:url(#default#VML);}
o:* {behavior:url(#default#VML);}
x:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--table
{mso-displayed-decimal-separator:".";
mso-displayed-thousand-separator:",";}
.xl15
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:????;
mso-generic-font-family:auto;
mso-font-charset:136;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
mso-background-source:auto;
mso-pattern:auto;
white-space:nowrap;}
.xl22
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:????;
mso-generic-font-family:auto;
mso-font-charset:136;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
border:.5pt solid windowtext;
mso-background-source:auto;
mso-pattern:auto;
white-space:nowrap;}
.xl23
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:9.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:????;
mso-generic-font-family:auto;
mso-font-charset:136;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
border:.5pt solid windowtext;
background:#339966;
mso-pattern:auto none;
white-space:nowrap;}
.xl24
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:12.0pt;
font-weight:700;
font-style:normal;
text-decoration:none;
font-family:????, serif;
mso-font-charset:136;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
mso-background-source:auto;
mso-pattern:auto;
white-space:nowrap;}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>Sheet1</x:Name>
<x:WorksheetOptions>
<x:DefaultRowHeight>225</x:DefaultRowHeight>
<x:Print>
<x:ValidPrinterInfo/>
<x:PaperSizeIndex>9</x:PaperSizeIndex>
<x:HorizontalResolution>-3</x:HorizontalResolution>
<x:VerticalResolution>0</x:VerticalResolution>
</x:Print>
<x:Selected/>
<x:Panes>
<x:Pane>
<x:Number>3</x:Number>
<x:ActiveCol>10</x:ActiveCol>
</x:Pane>
</x:Panes>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:WindowHeight>10470</x:WindowHeight>
<x:WindowWidth>16755</x:WindowWidth>
<x:WindowTopX>240</x:WindowTopX>
<x:WindowTopY>30</x:WindowTopY>
<x:HasEnvelope/>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>

<body>

<table x:str border=0 cellpadding=0 cellspacing=0 width=636 style='border-collapse:
collapse;table-layout:fixed;width:477pt'>
<col width=56 span=7 style='width:42pt'>
<col width=104 style='mso-width-source:userset;mso-width-alt:4437;width:78pt'>
<col width=140 style='mso-width-source:userset;mso-width-alt:5973;width:105pt'>
<tr height=22 style='height:16.5pt'>
<td height=22 class=xl24 colspan=2 width=112 style='height:16.5pt;mso-ignore:
colspan;width:84pt'>JOB TABLE</td>
<td class=xl15 width=56 style='width:42pt'></td>
<td class=xl15 width=56 style='width:42pt'></td>
<td class=xl15 width=56 style='width:42pt'></td>
<td class=xl15 width=56 style='width:42pt'></td>
<td class=xl15 width=56 style='width:42pt'></td>
<td class=xl15 width=104 style='width:78pt'></td>
<td class=xl15 width=140 style='width:105pt'></td>
</tr>
<tr height=15 style='height:11.25pt'>
<td height=15 class=xl23 style='height:11.25pt'>JobNo</td>
<td colspan=8 class=xl15 style='mso-ignore:colspan'></td>
</tr>
<tr height=15 style='height:11.25pt'>
<td height=15 class=xl22 style='height:11.25pt;border-top:none'>SE0001</td>
<td colspan=8 class=xl15 style='mso-ignore:colspan'></td>
</tr>
<tr height=22 style='height:16.5pt'>
<td height=22 class=xl22 style='height:16.5pt;border-top:none'>SE0002</td>
<td colspan=5 class=xl15 style='mso-ignore:colspan'></td>
<td class=xl24 colspan=2 style='mso-ignore:colspan'>New Table</td>
<td class=xl15></td>
</tr>
<tr height=15 style='height:11.25pt'>
<td height=15 colspan=6 class=xl15 style='height:11.25pt;mso-ignore:colspan'></td>
<td class=xl23>JobNo</td>
<td class=xl23 style='border-left:none'>no of Revence</td>
<td class=xl23 style='border-left:none'>no of Cost</td>
</tr>
<tr height=22 style='height:16.5pt'>
<td height=22 class=xl24 colspan=2 style='height:16.5pt;mso-ignore:colspan'>JOB
Revence</td>
<td colspan=4 class=xl15 style='mso-ignore:colspan'></td>
<td class=xl22 style='border-top:none'>SE0001</td>
<td class=xl22 align=right style='border-top:none;border-left:none' x:num>2</td>
<td class=xl22 align=right style='border-top:none;border-left:none' x:num>1</td>
</tr>
<tr height=15 style='height:11.25pt'>
<td height=15 class=xl23 style='height:11.25pt'>JobNo</td>
<td class=xl23 style='border-left:none'>ItemNo</td>
<td colspan=4 class=xl15 style='mso-ignore:colspan'></td>
<td class=xl22 style='border-top:none'>SE0002</td>
<td class=xl22 align=right style='border-top:none;border-left:none' x:num>1</td>
<td class=xl22 align=right style='border-top:none;border-left:none' x:num>0</td>
</tr>
<tr height=15 style='height:11.25pt'>
<td height=15 class=xl22 style='height:11.25pt;border-top:none'>SE0001</td>
<td class=xl22 align=right style='border-top:none;border-left:none' x:num>1</td>
<td colspan=7 class=xl15 style='mso-ignore:colspan'></td>
</tr>
<tr height=15 style='height:11.25pt'>
<td height=15 class=xl22 style='height:11.25pt;border-top:none'>SE0001</td>
<td class=xl22 align=right style='border-top:none;border-left:none' x:num>2</td>
<td colspan=7 class=xl15 style='mso-ignore:colspan'></td>
</tr>
<tr height=15 style='height:11.25pt'>
<td height=15 class=xl22 style='height:11.25pt;border-top:none'>SE0002</td>
<td class=xl22 align=right style='border-top:none;border-left:none' x:num>1</td>
<td colspan=7 class=xl15 style='mso-ignore:colspan'></td>
</tr>
<tr height=15 style='height:11.25pt'>
<td height=15 colspan=9 class=xl15 style='height:11.25pt;mso-ignore:colspan'></td>
</tr>
<tr height=22 style='height:16.5pt'>
<td height=22 class=xl24 colspan=2 style='height:16.5pt;mso-ignore:colspan'>JOB
Cost</td>
<td colspan=7 class=xl15 style='mso-ignore:colspan'></td>
</tr>
<tr height=15 style='height:11.25pt'>
<td height=15 class=xl23 style='height:11.25pt'>JobNo</td>
<td class=xl23 style='border-left:none'>ItemNo</td>
<td colspan=7 class=xl15 style='mso-ignore:colspan'></td>
</tr>
<tr height=15 style='height:11.25pt'>
<td height=15 class=xl22 style='height:11.25pt;border-top:none'>SE0001</td>
<td class=xl22 align=right style='border-top:none;border-left:none' x:num>1</td>
<td colspan=7 class=xl15 style='mso-ignore:colspan'></td>
</tr>
<![if supportMisalignedColumns]>
<tr height=0 style='display:none'>
<td width=56 style='width:42pt'></td>
<td width=56 style='width:42pt'></td>
<td width=56 style='width:42pt'></td>
<td width=56 style='width:42pt'></td>
<td width=56 style='width:42pt'></td>
<td width=56 style='width:42pt'></td>
<td width=56 style='width:42pt'></td>
<td width=104 style='width:78pt'></td>
<td width=140 style='width:105pt'></td>
</tr>
<![endif]>
</table>

</body>

</html>

View 2 Replies View Related

Can Create Access Form Layout Based On Table From Sql?

Sep 25, 2006

Hi,

Can this be done? Please advise. Thanks.Is there any template available in sql for creating forms?

View 1 Replies View Related

How To Make Form To Delete Record From Table In Access 2002

Jun 29, 2004

I like to give First Name and Last Name in two different text box and then hit the delete button (command button). Then it will do a query to find the person and delete the corresponding record from the table. Any kind of help will be appreciated. Thank you.

View 1 Replies View Related

Retrieving Specific Page(number Of Rows) Form Table

Sep 27, 2005

hi,

i need SP that receive 2 integers ,@NUM_ROWS and @PAGE_NUMBER,
and return the rows in that page.
for example:

SP(4,2) will return 4 rows in page number 2 .

So if i have table with 9 rows i will get rows 5-8,
the first page is rows 1-4 the second page is 5-8 and the 3 page is row 9.

i have to assume that rows can be deleted form that table.
thanks

View 3 Replies View Related

How To Change View Code Or Table Form Stored Procedure + -

Jun 1, 2008

need help with my problem
i have this view
this code change the value field "new_unit" evry month from 1 > 2 > 3 > 4
like this evry 4 month it return to 1 >2..........
------------------------------------------ for example

if i put
unit_date = 01/05/2008
and unit=1
than new_unit=1




Code Snippet

SELECT empID, ShiftType, unit_date, unit, ISNULL(NULLIF ((unit - DATEDIFF(mm, unit_date, '01/01/' + CONVERT(varchar, YEAR(GETDATE())))) % 4, 0), 4)

AS new_unit

FROM dbo.empList




my question is how to create a stored procedure that move forward (all the employee) the "new_unit" field
in +1 OR "unit_date" value MONTH +1


like create stored procedure name "plus" + so if i run this name stored procedure name "plus"

the stored procedure go to the viewor table and change the code view or table value

so i forward all the the "new_unit" or "unit_date" value IN one (change the cycle)+1

it doesn't matter if it change the "unit" value in the table "dbo.empList" or "unit_date" value

the important thing is that i can forward +1 or backward -1

evry time i run the stored procedure i get +1 (in the "new_unit")
and olso
create stored procedure name "minus" + so if i run this name stored procedure name "minus"
this stored procedure that move backward the the "unit" value in the table "dbo.empList" or "unit_date" value in -1

TABLE dbo.empList

empid ShiftType unit_date unit

----------------------------------------------------------------------------
11111 6 01/01/2008 1
2222 8 01/03/2008 4
3333 9 01/04/2008 3

TNX for the help

View 7 Replies View Related

Integration Services :: Import Data Form One Table To Another Server

May 27, 2015

import data form one table to another.Both table have different schema.Lets say

1. Employee(Empid, ename,address,designation,Joindate,DOB).
2.Person(name,address,DOB)

I need to import person table data into Employee table.

Note :

1 empid is auto increment
2. If Person.DOB is not present insert null into employee.DOB
3.JoinDate should be initialized with current date. 

Currently I am using

1.OLE DB Source
2.Data Conversion
3.OLE DB Destination.

View 11 Replies View Related

Binding A DataSource Table Column To A Form Object (RadioButtons)

Oct 25, 2006

Hi,

  I have a little question.  I have an application which interfaces with a SQL Express Database.   On a form, I want to bind a control which is made of several Radio buttons to a table column which is in fact a varchar(1).  This is the picture:

        Table column:  OptVisualRpt  varchar(1)

        Screen control:  2 radio buttons

                                    rb_VisRPTbImp_O    for "yes"

                                    rb_VisRPTbImp_N    for "no"

 

  I'm really scratching my head as how I can bind a single table column to my radio buttons controls.   I think that I just can't this way but rather have to use an intermediate variable or control. 

Solution 1?

 I thought of using a local variable that I would set to "y" or "n" following "CheckedChanged" events fired from radio buttons but I don't know how to bind this variable to my table column.                 

Solution 2?

  I thought of placing a hidden text control into my form, which one would be binded to my table column, that I would also set to "y" or "n" following "CheckedChanged" events fired from radio buttons.

Any of these solutions which would be feasible or any more neat way to do it?

Many thanks in advance,

Stéphane

View 1 Replies View Related

How To Make The SSMSE To Return Whole Records Without Any Close Query Form And Re-create Query Form Operation?

Dec 25, 2007

Hi,
I got a problem.
I installed Microsoft SQL Server Management Studio Express 2005 version.
And I created a Compact database.
I created an connection in SSMSE to connect the database and opened a query form.
then, i run the following sql:

Select * from Table1

It returned 3 records to me.
After that, I used program to insert record into this table.
Then i ran this sql again, it still show me 3 records.
I closed the query form, and re-created a new query form, then run the sql, it returned 4 records to me.

Why? It's very strange and difficult to operate, right?
Is there anyone know how to make the SSMSE to return whole records without any close query form and re-create query form operation?

Thanks a lot!

And Merry X'max!!!

View 4 Replies View Related

First Form Normalizations And Second Form Normalization

Jul 19, 2006

Hi everyone,
What is the main difference between first form normalizations and second form normalization ?
In my opinion, they are both generated for the same operation which is to prevent redundancy(in other words; duplication of data in several records).
So would you please explain it to me ?

Thanks

View 1 Replies View Related

Where To Order The Table Values Displayed In A Web Form Object? In Sql Server Or In The Application?

Sep 10, 2004

Hi,

I have a table in my database with several car types, and the order I want for that table is:

Car_typeA_1
Car_typeA_2
Car_typeA_3
Car_typeA_4
Other_Cars_typeA
Car_typeB_1
Car_typeB_2
Car_typeB_3
Other_Cars_typeB
Car_typeC_1
Car_typeC_2
Car_typeC_3
Car_typeC_4
Car_typeC_5
Other_Cars_typeC
...


This table is more or less always the same, but from time to time I want to add a new car type, for instance; Car_typeA_5, but this new type must be located under the last register, in the example under ‘Other_Cars_typeC’. So, now the order is wrong, and when I want to display these car types to a web form object, the items will appear wrong ordered.

My question is: To order the values(items) correctly, Where I have to do it? In the web page (ASP.NET) code behind, or somewhere in SQL Server (for example in the Stored Procedure that passes the value to the application)? Or maybe in the same database table..?

Thank you,
Cesar

View 7 Replies View Related

How To Prevent System Form Locking A Table In Case Of Large Insertion

May 2, 2008

Hi,

I found out that executing the procedure SP_INDEXOPTION and setting 'AllowRowLocks' to false i can prevent the sql server from locking rows in a table and 'AllowPageLocks' prevents from pages being locked. I need to preform same operation
in case of tables. I need to perform insertion operations concurrently and acquire required locks manually. Is there a way to stop sqlserver from acquiring locks on the table. I need to disable all the locks (row, page and table).

Thank you in advance.

View 9 Replies View Related

How Do I Bring In A Date Which Is In Integar Form Into A Databse As A Date Form.

Jul 23, 2005

HiI have a Platinum database which stores dates in integer form e.g the dateis formatted as below:Column_name Type Length Precision------------------------------ ------------------------------from_date int 4 10Some of the dates in the Platinum database are as follows:729115729359730059730241730302730455How can I bring them into SQL 2000 as valid dates.Thanks for your assistanceSam CJoin Bytes!

View 1 Replies View Related

SQL Server 2014 :: Loop And Query CSV Files In Folder Using Union All Query To Form Resultant Table On Server?

Jun 27, 2014

I am trying to run a UNION ALL query in SQL SERVER 2014 on multiple large CSV files - the result of which i want to get into a table in SQL Server. below is the query which works in MSAccess but not on SQL Server 2014:

SELECT * INTO tbl_ALLCOMBINED FROM OPENROWSET
(
'Microsoft.JET.OLEDB.4.0' , 'Text;Database=D:DownloadsCSV;HDR=YES',
'SELECT t.*, (substring(t.[week],3,4))*1 as iYEAR,
''SPAIN'' as [sCOUNTRY], ''EURO'' as [sCHAR],

[Code] ....

What i need is:

1] to create the resultant tbl_ALLCOMBINED table

2] transform this table using PIVOT command with following transformation as shown below:

PAGEFIELD: set on Level = 'Item'
COLUMNFIELD: Sale_Week (showing 1 to 52 numbers for columns)
ROWFIELD: sCOUNTRY, sCHAR, CATEGORY, MANUFACTURER, BRAND, DESCRIPTION, EAN (in this order)
DATAFIELD: 'Sale Value with Innovation'

3] Can the transformed form show columnfields >255 columns i.e. if i want to show all KPI values in datafield?

P.S: the CSV's contain the same number of columns and datatype but the columns are >100, so i dont think it will be feasible to use a stored proc to create a table specifying that number of columns.

View 9 Replies View Related

Getting Out Of Form

Jul 11, 2007

I am trying to add records to SQL database, thru <form> </form> on click of button, The system is working fine, Databse table is getting updated correctly.
But screen displays the same form again while i want it to open another asp.net page i.e. buy.aspx and also generate an e-mail automatically.
I m stuck. Please help.
 pcg
 
Relevent code of mine is as below.
<script runat="server">
    void addtosalelist(Object sender, EventArgs e)    { .... .... dbConnection.Open(); .... ....        dbConnection.Close();     }
 
<form action="buy.aspx" method="post" runat="server">.........<asp:Button id="button1" onclick="addtosalelist" runat="server" Text="Submit"></asp:Button>                                    </form>

View 5 Replies View Related

Help Me Form This SQL?

Mar 2, 2006

Hi all, this'll be my first post here, hopefully I'll get this right and someone can help.

I'm trying to generate a subquery that will take a set of one-column rows and concatenate them into a single cell.

I've adapted from this article (http://www.sqlteam.com/item.asp?ItemID=2368) the following code:
DECLARE @topicList varchar(200)

SELECT @topicList = COALESCE(@topicList + ', ', '') + MAB_topics.topic_name
FROM MAB_topics

SELECT @topicList
that produces a list of all the topic_names in the database seperated by commas. That's fine.

I couldn't follow all the code in this thread (http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=18363) but I was able to extract and modify this code:

DECLARE @topicList varchar(200)

SELECT MAB_topics.topic_name
INTO #tmp
FROM MAB_topics, MAB_articleIndex
WHERE MAB_articleIndex.article_ID = 76 AND
MAB_topics.topic_ID = MAB_articleIndex.topic_ID

SELECT * FROM #tmp

drop table #tmp
which returns the two topic_names that I'd expect. (Note: this is my very first day declaring variables and using temp tables.) So I keep thinking that the following code would combine the two above working functions. But, when I run it in Query Analyzer, it just returns "(2 row(s) affected)" instead of a recordset.

DECLARE @topicList varchar(200)

SELECT MAB_topics.topic_name
INTO #tmp
FROM MAB_topics, MAB_articleIndex
WHERE MAB_articleIndex.article_ID = 76 AND
MAB_topics.topic_ID = MAB_articleIndex.topic_ID

SELECT @topicList = COALESCE(@topicList + ', ', '') + #tmp.topic_name
FROM #tmp

drop table #tmp
What am I doing wrong? I'm sure it's something simple but I've been reading and trying and reading and trying for a few hours and haven't gotten it yet. The ideal response would figure out what I'm trying to do as well as what my mistake is and explain how I'm misthinking. A close second would be just fixing my code. :)

Thanks in advance,

Chris

View 6 Replies View Related







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