Adding Record To Multiple Categories

Jun 16, 2006

I am pretty new to the DB part of this but have built an asp.net web appplication with 2 tables:
FORMS and UNITS
I have created a web page that will allow users to add forms and associate a unit with that form. I now need to be able to allow users to associate the form with multiple units.
I can change the web page list box to allow multiple selections but that doesn't solve the problem. This seems like a pretty simple task but I can't seem to find anything on it.
any help???
below is the stored procedure I was using:
CREATE PROCEDURE dbo.USP_AddForm

@UNIT_IDint,
@F_TYPE varchar(20),
@Titlevarchar(100),
@Keywords ntext = NULL,
@Descriptionntext = NULL,
@FileNamevarchar(50)


AS
BEGIN

SET NOCOUNT ON
DECLARE @NewFOrmID INT
INSERT FORMS

(
UNIT_ID,
F_TYPE,
Title,
Keywords,
Description,
FileName,
RevDate
)

VALUES
(
@UNIT_ID,
@F_TYPE,
@Title,
@Keywords,
@Description,
@FileName, GetDate()
)

SELECT @newFormID = @@IDENTITY
SELECT newFormID = @newFormID
END


GO

View 1 Replies


ADVERTISEMENT

Multiple Categories In Same Row

Apr 20, 2007

Hello folks,

I've been pounding on this for a while, after countless searching I have to break down and ask for help.

I have a table set up like so:

+-----+------------+---------------+------------+
| id | title | path | category |
+-----+------------+---------------+------------+
| 1 | Firemen | firemen.pdf | CGL |
| 2 | Garages | garages.pdf | E&O |
| 3 | Auto | autos.pdf | EPLI |
| 4 | Garages | garages.pdf | CGL |
| 5 | Houses | houses.pdf | E&O |
+-----+------------+---------------+------------+



If there's a title that has more than one category (Garages for example), I would like to be able to show both categories in the same row.

Like so:

Title: Firemen
Path: firemen.pdf
Cat: CGL

Title: Garages
Path: garages.pdf
Cat: E&O, CGL

Title: Auto
Path: autos.pdf
Cat: EPLI


I assume that it might be a better set up if the category was a separate table, but I was hoping there is a way around it. I've tried grouping and subqueries but can't seem to get anything to work.

If someone could steer me in the right direction, it would greatly be appreciated. Thanks much and happy Friday!

Erik

View 2 Replies View Related

Reporting Services :: Multiple Categories In Area Chart

Jul 16, 2015

I need to create area chart using SSAS cube which will be having :

sum(A) as per the Series group i.e Projects (expression used is Sum(Fields!Demand_FTE.Value))

Sum(B) as per the CategoryGroup1 =Sum(Fields!Demand_FTE.Value,"CategoryGroup1") where categoryGroup1 is calculated date

And Sum(C) = sum(Lookup(Fields!Time_FY.Value,Fields!Time_FY.Value,Fields!Capacity_FTE.Value, "DataSet2")).

I want Sum(C) to be calculated on Fields!Time_FY.Value (which is  CategoryGroup2)

Sum(C) do not have any links with CategoryGroup1 and that is why my graph is synchronized.

Sum(A and B) belongs to Dataset1 and SUM(C) belongs to Dataset2

View 2 Replies View Related

Displaying Multiple Categories (from Seperate Tables) To Be Viewed On One Page

Mar 24, 2007

Hello.
 I just created separate tables for each of my categories and  wanted to know how to return them all to be viewed on one page using the SQL Datasource (or whatever) This is for user accounts. I just need to know that part.
 Sincerely,
Computergirl
 

View 1 Replies View Related

How To Get All Sub Categories For All Parent Categories

Jan 18, 2012

I have a table Category whose structure is as follows:

id
name
parentid

So i have number of nodes from the root of a specific category. How to get all the sub categories(ie nodes) for all parent categories?

View 14 Replies View Related

Categories And Sub Categories Best Practice

Aug 9, 2007

I have an application which has a database table called Category. Its very simple, with fields id and categoryname.

My client now wants functionality for sub categories. Whats the best way to do this. My initial thought was to keep the same database table but have a 3rd column called ParentID which contains the ID of the parent category.

Is this the best way? Or something else.

Thanks

View 2 Replies View Related

Multiple Record Insertion For Each Record From Source

Jan 10, 2008



Hi,

How can we insert multiple records in a OLEDB destination table for each entry from the source table.
To be more clear, for every record from source we need to insert some 'n' number of records into the destination table. this 'n' changes depending on the record.
how is this achieved.

thanks.

View 4 Replies View Related

Adding A Value + 1 To A Record

Nov 29, 2007

Hello

I wish to add some records to my database but I am having problems asking the SQL commands to add 1 to the previous number.

I'll explain what I mean....!

The database automatically increases the communication_number once each time a record is added. However I'd like to amend the command below to say "add 1 to the current communcation_number" rather than input a number manually as I have done below:-

insert into "communications"
(address_number, contact_number, device, ex_directory, dialling_code, std_code, number, extension, notes, amended_by, amended_on, cli_number, communication_number)
values (105, NULL, 'WW', 'N', NULL, 'WW', 'W', NULL, 'www.abc.co.uk', 'Jon', 2007-11-29, NULL, '30001');

Any help would be much appreciated.

Thanks,

Jon

View 10 Replies View Related

Retrieve Id After Adding A New Record

May 13, 2005

How do I retrieve the id of the record after I INSERT it?

View 4 Replies View Related

Problem With Adding Record Into Database

Feb 3, 2004

When I try to build my solution, it tells me that "SQLCommand" is not defined.

What's the problem?

Sub submitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
'If Page.IsValid Then
Try
Dim MySQL = "addCustomerSQL"
Dim cmd As New SQLCommand("addCustomerSQL", dbConn)
cmd.Commandtype() = CommandType.StoredProcedure
cmd.Parameters().Item("@username").Value = userText.Text
cmd.Parameters.Item("@password").Value = passText.Text
dbConn.Open()
cmd.ExecuteNonQuery()
dbConn.Close()


Catch ex As Exception

End Try
End Sub

View 5 Replies View Related

Adding B Record To Output File

Apr 9, 2014

I'm not sure if I can explain this properly, but I'll try. I need to create an output file with a detailed record. I've been able to create a query that will give me the format and fields of what I need. However, the file layout calls for an additional "B" record if certain criteria is met in the detail immediately following the detail record. For example, if the PaymentMethodID = 10, then I need to add a "B" record that displays the PayeeName. I'm not sure if this would be a separate Select or a Union or maybe an Insert? All of our current layout are just Detail records and a Control Record.

Here is my current Select for the Detail:

SELECT DISTINCT
CONVERT(CHAR(10), ba.AccountNumber)
+ (REPLICATE('0', 10 - LEN(p.CheckNumber)) + CONVERT(VARCHAR(10), p.CheckNumber)) + REPLACE(CONVERT(VARCHAR(6), p.CheckDate, 1), '/', '')

[Code] ....

What I would need to add a separate B record?

View 1 Replies View Related

Difficulty Adding A Record In SSMSE

Aug 21, 2006

I'm new to SQL Server and I'm using 2005 Express with SSMSE, and having trouble adding a record to a table "manually" by typing in the data.

I find I can change most of the fields by viewing the table in SSMSE and just clicking on the field and editing it then clicking "execute SQL" but for some reason the changes don't "take" when a date field is involved.

Is there a special or proper way to enter a date that I'm not aware of? I'm not having much success figuring out this online help stuff from within SSMSE, I keep getting to help on the help system itself (oops).

TIA!

View 3 Replies View Related

Adding Image Or Picture To A Database Record

Jun 17, 2007

Hi,

I am new to SQL Server and I have got this problem and I am wondering if anyone could provide me with a solution, please.

I created a Product database table using Visual Basic 2005 Express and SQL Server 2005 Express. I have just added a new column [Picture] with IMAGE datatype to the database table, which of course, should store an image or picture of a product. I am writing to kindly ask you guys for help.

i) How do I store a picture or image for each record of this column [Picture] of database table? I have tried and all that I can see is < binary data > in the picture column, and when I start the VB 2005 Express form is a blank picture box!

ii) How do I get this image to display on Visual Basic 2005 Express form, so that when a product is selected the product image is displayed too? All text data appears but not the picture!

Your help much appreciated. Thanks.

Paul

View 3 Replies View Related

Need Help With Adding A Duplicate Record Count Column To Query

Jul 23, 2005

I am attempting to create a simple recordset that would return thenumber of duplicates that exist in a table with a single column. Forexample if I had a table like the following:ID Reference Amount1 123456 1.002 123456 2.003 123 1.00I would like to get the following result:ID Reference Amount RecCount1 123456 1.00 22 123456 2.00 23 123 1.00 1Please help!Thanks,Shawn

View 2 Replies View Related

Integration Services :: Adding Trailer Record To End Of A File?

Apr 27, 2011

I have an SSIS package which takes a SQL Query and generates a PIPE (|) delimited flat file. Simple enough. However, I also need to add a Trailer record at the bottom of the file (footer). To make this happen I could either do a UNION ALL on the same query script or what I've done is to create another query with the Trailer record and using the Merge component simply merged and appended the trailer record at the botton of the actual file.

The issue, however, is that the trailer record is always including extra PIPES at the end of the trailer. According to business, this wouldn't load properly at our vendor side due to the extra pipes in the trailer record as it'll be seen as additional columns.

Is there anyway to get rid of those extra pipes at the end of the trailer?

Trailer record should look like this:

TRAILER|A|B|C|D|

As of now, the appended Trailer record looks like this (additional pipes for each column in the main query script):

TRAILER|A|B|C|D|||||||||||||||||

View 4 Replies View Related

Adding A Header Record To A Fixed Width Flat File Data Export.

Jun 21, 2007

Hi-I have a sql database (2005) that I need to extract a report from that looks somehintg like  SELECT * From Empl_Hours WHERE some_flag <> 'true' .The thing works fine, but the problem is this: I need to insert a record in the 1st row that looks like "Static_text"+row_count() +"more_static_text"where row_count is the actual # of rows that were retrieved. Thanks in advance for any help.DAn 

View 3 Replies View Related

PC SQL Server Table (with A Column Classified Unique) Synchronizes (using Merge) With 2 PPCs SQL Mobile Adding The Same Record

Aug 29, 2006

Hi, I have a doubt about the behaviour of SQL Server 2005 in the situation I'm going to describe you.
Suppose that you have a SQL Server 2005 database on your PC, and suppose that this database has a table with a column classified as "unique" (so it's impossible for this table to contain 2 records having the same value in this column).
Suppose that you publish this database and you create 2 SQL Server Mobile 2005 subscriptions on 2 Pocket PCs.
Suppose now that the first PPC (using an embedded program) creates a record with a certain value for the column (and adds it to the table), and the second PPC makes the same thing (it inserts a record with the same column value of the first PPC).
At this point, you connect the 2 PPCs to your PC (one by one, of course), to synchronize (using merge replication) the databases...

WHAT HAPPENS??? Does an error raise?
Must you give a publication setting in which you say that, if this situation occurs, PC SQL Server holds the last (or the first, as you decide) record acquired? Is it possible?

Thank you very much

View 1 Replies View Related

Adding Multiple Values Into A Row/column Help

Mar 6, 2004

Whats the fastest easiest way to take a select that returns say 4 values for the expression into a single column on defined row

basically I mean i want to do an update to say a persons i dunno ummm places they have traveled and I want it listed like france;usa;germany etc etc and the data would always be in the tables i pull from so I can overwrite the data each time i run it but has to take 3 or more values from a query and put them in separated by say a ; into the same persons coloumn that stores the info.

I did this once before with a cursor and adding a variable to itself with colasce or whatever the command was, but was just wondering if there is a fast way to do this by chance that im not thinking about :P.

Thanks!

View 3 Replies View Related

Adding Details To Multiple Records

Nov 29, 2007

Hello

I am trying to add a website address to all the records in a database that match a certain criteria. The statement that I am using is shown below, but surprise surprise, it's not working! I'm new to SQL so any help would me much appreciated! Thanks.

declare @ComNum int
set @ComNum = (select max(communication_number)+1 from communications)

insert into "communications"
(contact_number, device, ex_directory, dialling_code, std_code, number, extension, notes, amended_by, amended_on, cli_number, communication_number)
values (NULL, 'WW', 'N', NULL, 'WW', 'W', NULL, 'www.abc.co.uk', 'Jon', 2007-11-29, NULL, @ComNum);
select name
from organisations
where name ='Abc Limited'

So, I have not included a VALUE for CONTACT_NUMBER as I wish to update all records with the website details as per the INSERT statement where the NAME column in the ORGANISATIONS table is 'Abc Limited'. I know something is wrong but I can't quite work out what!

View 11 Replies View Related

Adding Precedence To Multiple Files

Jun 15, 2007

hi all,

i have a package here which updates a DB from a flat file source.now the problem is i may get multiple files.i have used a for each loop to handle this. it takes files based on the files name9(file names has a timestamp in it).but i want to give files in order of its Creation time.

Please help me on this.i have written a script task before the for each loop and i have got the minimum creation date from all the files,i am not able to going forward from here.

does any body has an idea!!

View 4 Replies View Related

Need Help Adding Multiple Values To Dropdownlists Datatextfield

Jan 15, 2004

I'm trying to put a range of dates into the datatextfield of my ddl. I'm using the query:

string strProps2 = "SELECT sc_id, cast(begin_date AS varchar) + ' - ' + cast(end_date AS varchar) AS XYZ From Archived_Property_Changes WHERE Property_number = " + qryPN + " ORDER BY end_date";

but it gives me an empty ddl. the datavaluefield shows the correct results, but it's not displaying the correct data from the datatextfield. I removed the casts from the SQL query and it returns:

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value

Below is my ddl code:

SqlCommand objCommandProps2 = new SqlCommand(strProps2, myConnection);
SqlDataReader objReaderProps2 = objCommandProps2.ExecuteReader();

ddlArchive.DataSource = objReaderProps2;
ddlArchive.DataValueField = "sc_id";
ddlArchive.DataTextField = "XYZ";
ddlArchive.DataBind();
ddlArchive.Items.Insert(0, "Select A Period");

Any thoughts are duely appreciated...

View 2 Replies View Related

Adding Multiple Packages To Your File System

Feb 28, 2008

My current environment has multiple packages stored in SQL server (MSDB).
When working on a set of packages I want to bring them into my local development area
Add existing package only allows you to pull one package at a time - anyone have the secret to selecting multiples

Thanks

View 3 Replies View Related

DB Engine :: Adding Multiple Log File In Existing Database

Jun 30, 2015

Can we add multiple log file in existing database?

View 8 Replies View Related

Multiple Row Value In One Record

Jun 11, 2008

SOURCE TABLE
ID SEQ COM VARCHAR(10)
1 1 I
1 2 am
1 3 doctor
2 1 I
2 2 am nurse
DESTINATION TABLE --Each comm field is varchar(20)
ID_COM1___COM2______COM3
1__I______am_________doctor
2__I______am nurse____NULL

Please Help

View 6 Replies View Related

Analysis :: Unable To Browse Data When Adding Multiple Dimensions?

Jul 5, 2015

I have one dimension and one measure group. I deployed and processed the cube. Now I am able to browse the data. Now I added one more dimension. I deployed and reprocessed again the Cube. Now I am not able to see any values.  I am getting like below.

View 6 Replies View Related

Multiple Table Record

Oct 13, 2007

I have two table and there are releationsheep between them.
Topic:
topicId, topicName, topicDate
Reply:
replyId,topicId,replyName,replyDate
I want to insert two table at the same time.
Topic: 1,example,10/21/2007
Reply:1,1,example, 10/21/2007
 
 

View 1 Replies View Related

Multiple Record Insert

Dec 9, 2002

I am trying to do an update to a database with the code below, the code will work in generating a single record (if i exclude the IF statement) but i need it to create multiple new records based on the IF statement (or something similar) i have in the code. It needs to create updates for every record that has a parentguid that matches the one specified in the code.
the idea is, the hierachy structure in the tables are:

Location1
--> Part1
--> part2 etc
Location2
--> part1 etc

i want it so that when i input a new part it updates to all the locations. The locations all have the same parentguid (the one specified in the code)
With regards to the stored procedure it executes, this stored procedure creates the entry. I don't really want to change the stored procedure because other functions reference and use it.

My code:

DECLARE @PREFIX VARCHAR(6)
DECLARE @CODE VARCHAR(8)
DECLARE @GUID UNIQUEIDENTIFIER
DECLARE @PARENTGUID UNIQUEIDENTIFIER
DECLARE @PARENTGUID2 VARCHAR(50)
select @parentguid2 = parentguid from dsdba.itemgroups

if @PARENTGUID2 = '8CF850AD-2026-411B-AABE-BF1584624EB3'
BEGIN

SET @PREFIX = 'JUST'

SELECT @PARENTGUID = GUID FROM DSDBA.iTEMGROUPS WHERE CODE = @PREFIX

SET @CODE = @PREFIX + '02'
SELECT @GUID = NEWID()

EXEC DSDBA.usp_ItemsDB_InsertGroup @GUID, @CODE, 'JMB', @PARENTGUID, 1

END

:confused:

View 1 Replies View Related

Insert Multiple Record

Mar 3, 2004

can anyone help to explain how to insert multiple record into one/two table?

ex:lets say when user specify start date and end date, then we need to created and insert the record on that duration.

and how to do with insert the record weekly or monthly?until the end of the date!

View 1 Replies View Related

How To Get Results In One Row From Multiple Record

Jul 19, 2013

I have following situation -

DECLARE @table1 TABLE
(
Stuid INT NOT NULL,
schoolcd varchar(10),
enterDate Datetime,
entercd char(10)
)

INSERT @Student VALUES
(4648, ‘20130515’, ‘892’,’30’),
(4648, ‘20130103’, ‘764,’10’)

SELECT STATEMENT will give me following -

Stuid schoolcd entercd enterDate
46488923005/15/2013
46487641001/03/2013

Desired output is one row for two or more records for same stuid
464889230 05/15/20137641001/03/2013xxxxxxx/xx/xxxx

How can I accomplish that?

View 5 Replies View Related

Automatically Adding Records To Child Table When Record Added To Parent Table

Aug 19, 2006

In SQL Server 2000, I have a parent table with a cascade update to a child table. I want to add a record to the child table whenever I add a table to the parent table. Thanks

View 1 Replies View Related

Multiple-step OLE DB Operation Generated Errors. Adding Colums Using ADOX

Nov 26, 2007

Hi
I'm trying to add columns to an existing table using ADOX. I'm using C++/CLI. My code is as follow

Table->default->Append("new_column", ADOX:: DataTypeEnum::adWChar, 255);
Table->default["prev_instance_id"]->Properties["Jet OLEDB:Compressed UNICODE Strings"]->default = true;

The first line of code works fine but when I try to set the value of the property I get the following excpetion:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in MyDll.dll
Additional information: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

Any idea?

Marco

View 7 Replies View Related

Adding A New Record Takes Longer And Longer -- Archive? (was Table Help)

Mar 1, 2005

Hi we have a table with about 400000 records in it. It starting to take longer and longer to add a new record. I was thinking of creating another identical table and archiving off most of the records every month (we are now adding about about 4000 records a day) . Is this the best thing to do?
I don't know a lot about sql server so any help or suggestions would be great

View 4 Replies View Related

Displaying Multiple Records From One Record

Jan 26, 2007

Hi there,
I've a complex stored procedure, which I'm trying to get a list of one or more users based the list of records that are being display.  If I mentioned the overall store procedure here it'll turn you off, so I'll put the questions in bitesize chunks.
Example would be if Bob and Luke work for Acrm Corp and John for Maxwellarms Ltd, and there was an intimediate table which linked both.  With my stored procedure I want to display both names in the same row as Acrm Corp.  Is there a way to do this? 
User tableUserid      Username
1             Bob2             Luke3             John
Store procedure resultCompanyname         Username
Acrm Corp               NullMaxwellarm Ltd        Null
Regards,

View 1 Replies View Related







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