Creating A Child Row With Two Parents? (in One Column)

Sep 29, 2006

Hi!

How can I make a relation that would let me relate an employee to two departments?

There is a table with emloyees and each one works in a department and there is a foreign key relation in the child (employees) table to the parent (departments) table. So can an employee work in two departments? (it's not impossible to imagine, is it?) And how would I retrieve all the employees of a department?

Or in other words, if I were working on some kind of software for my local supermarket and they need to keep track of all bills they ever gave out. I would make this products table and this bills table. Then I would create a foreign key column in the products table and fill it with bill_ids from the bills table and make retrieving bill items a simple getchildrow[](bill_row). Note that this is only an analogy, I need it done this way. How? (using C# express 2005, and SQL express and DataSets)

View 12 Replies


ADVERTISEMENT

Reporting Services :: Creating A Child Column Group In A Table?

Nov 9, 2015

I have the following column values (which represent the hours in a day) - 

I want to be able to create a "child group" which would create 15 minute interval values under each hour, like - 

0   15   30    45    60 

So these would repeat under, each "hour" column value.

How can I do this ?

View 7 Replies View Related

Creating Report Based On Parent-child Dimension

Nov 17, 2005

Hi

View 43 Replies View Related

SSMS Express: Creating Parent-Child Table Via LEFT OUTER JOIN - Error Message 156

May 22, 2006

Hi all,

I got an error message 156, when I executed the following code:

////--SQLQueryParent&Child.sql---////////

Use newDB

GO

----Creating dbo.Person as a Parent Table----

CREATE TABLE dbo.Person

(PersonID int PRIMARY KEY NOT NULL,

FirstName varchar(25) NOT NULL,

LastName varchar(25) NOT NULL,

City varchar(25) NOT NULL,

State varchar(25) NOT NULL,

Phone varchar(25) NOT NULL)

INSERT dbo.Person (PersonID, FirstName, LastName, City, State, Phone)

SELECT 1, "George", "Washington", "Washington", "DC", "1-000-1234567"

UNION ALL

SELECT 2, "Abe", "Lincoln", "Chicago", "IL", "1-111-2223333"

UNION ALL

SELECT 3, "Thomas", "Jefferson", "Charlottesville", "VA", "1-222-4445555"

GO

----Creating dbo.Book as a Child table----

CREATE TABLE dbo.Book

(BookID int PRIMARY KEY NOT NULL,

BookTitle varchar(25) NOT NULL,

AuthorID int FOREIGN KEY NOT NULL)

INSERT dbo.Book (BookID, BookTitle, AuthorID)

SELECT 1, "How to Chop a Cherry Tree", 1

UNION ALL

SELECT 2, "Valley Forge Snow Angels", 1

UNION ALL

SELECT 3, "Marsha and ME", 1

UNION ALL

SELECT 4, "Summer Job Surveying Viginia", 1

UNION ALL

SELECT 5, "Log Chopping in Illinois", 2

UNION ALL

SELECT 6, "Registry of Visitors to the White House", 2

UNION ALL

SELECT 7, "My Favorite Inventions", 3

UNION ALL

SELECT 8, "More Favorite Inventions", 3

UNION ALL

SELECT 9, "Inventions for Which the World is Not Ready", 3

UNION ALL

SELECT 10, "The Path to the White House", 2

UNION ALL

SELECT 11, "Why I Do not Believe in Polls", 2

UNION ALL

SELECT 12, "Doing the Right Thing is Hard", 2

GO

---Try to obtain the LEFT OUTER JOIN Results for the Parent-Child Table

SELECT * FROM Person AS I LEFT OUTER JOIN Book ON I.ID=P.ID

GO

////---Results---//////

Msg 156, Level 15, State 1, Line 5

Incorrect syntax near the keyword 'NOT'.

////////////////////////////////////////////////////

(1) Where did I do wrong and cause the Error Message 156?

(2) I try to get a Parent-Child table by using the LEFT OUTER JOIN via the following code statement:

Msg 156, Level 15, State 1, Line 5

Incorrect syntax near the keyword 'NOT'.

Can I get a Parent-Child table after the error 156 is resolved?

Please help and advise.

Thanks,

Scott Chang

View 9 Replies View Related

Parent Child Relationship Column Hint?

Feb 22, 2007

I've got a dilemma which I hope someone has a solution to.

Let's say we're building a data mining model to predict aircraft reliability. In the training table we've got a column (among many others) with a unique aircraft ID, and then a column for the type (737,747) and then a column for the series (100,200,300). I.E. A 737-800 series would be "737" and "800".

There is in essence a parent-child relationship between these 2 columns. 737's should share a common set of reliability factors, and then those factors might be further defined by the series number (for instance, the 737 might have very reliable radar except for the 500 series). The series is analogous to what model year a car is. What I want to make sure doesn't happen is for the system to correlate a 747-400 and a 737-400 because they are the same series. They are totally independent if the model number is different.

My only idea was to merge the columns and have a single value "737-100". But it would seem then that the model won't have any idea that a "737-100" and "737-200" should have a lot more in common than a "737-100" because the values will be completely different.

I was hoping to find some sort of parent-child hint in the column properties but found none.

What solutions have other people tried? It sure seems that there should be an elegant solution for something like, but I'm missing it.

Geof

View 3 Replies View Related

Multiple Parents For One Foreign Key

Jan 30, 2004

Hi,

I am trying to figure out if this is possible in Oracle or Mysql

Lets say I have 3 tables such that C could have either A or B as its parent.

A
{ id, name}

B
{id, name}

C
{other_id, comment}

Now other_id could be either A.id or B.id. What I want to be able to do is to define a foreign key constraint of the type:

CONSTRAINT FK_C FOREIGN KEY (other_id) REFERENCES A(id) ON DELETE CASCADE,
CONSTRAINT FK_C FOREIGN KEY (other_id) REFERENCES B(id) ON DELETE CASCADE

such that deleting A.id automatically deletes C.other_id where A.id = C.otherid and same for B.id

Ofcourse i am not able to do this. Is there any way that this can be done in Oracle and Mysql?

Thanks a lot,
Priyanka

View 2 Replies View Related

Query To Trace All Parents

Jul 23, 2005

Hi,I have a table with filled out below data:+------+-----+|parent|child|+------+-----+|A |B ||B |C ||B |E ||C |D ||E |F ||E |G |+------+-----+So I have to make a query which get all 'parent' values values forgiven child value.For example :-----------------If I have to get all parent values for 'D' child., query must get thisvalues : C, B, A.If I have to get all parent values for 'F' child., query must get thisvalues : E, B, A.If I have to get all parent values for 'C' child., query must get thisvalues : B, A.If I have to get all parent values for 'B' child., query must get thisvalues : A only.-----------------Is it possible to create a query which will covers all above conditionsor not using only sql statement without UDF or stored procedures.Any solutiuons?Sincerely,Rustam Bogubaev

View 3 Replies View Related

SQL XML :: How To Use Multi Sub Parents Using CDATA Tag

Oct 8, 2015

We have stored some special characters in our database and when we extract as XML Auto, Elements it through error illegal characters during import. I am looking and saw CDATA with Explicit option but don't know how to use it with multi tags like:

<1>
<12>
<23>
<34>
</34>
</23>
</12>
</1>

View 12 Replies View Related

Expanding Hierachy With Multiple Parents

Jul 20, 2005

I have a user assigned multiple roles and a role can be inherited frommultiple parents (see below). How do I answer such questions as "Howmany roles does the user belongs to?"I answered the above questions by using .NET but I think it can bemore efficient by using just SQL. I would appreciate if you can giveme an answer.Thank you.CREATE TABLE [dbo].[tb_User] ([Id] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY,[Name] nvarchar(99) NOT NULL UNIQUE,[Password] nvarchar(99) NOT NULL,) ON [PRIMARY]GOCREATE TABLE [dbo].[tb_Role] ([Id] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY,[Name] nvarchar(99) NOT NULL UNIQUE,) ON [PRIMARY]GOCREATE TABLE [dbo].[tb_User_Role] ([UserId] [int] NOT NULL ,[RoleId] [int] NOT NULL,) ON [PRIMARY]GOALTER TABLE [dbo].[tb_User_Role] WITH NOCHECK ADDCONSTRAINT [PK_tb_User_Role] PRIMARY KEY CLUSTERED([UserId],[RoleId]) ON [PRIMARY]GOCREATE TABLE [dbo].[tb_Parent_Role] ([RoleId] [int] NOT NULL ,[ParentRoleId] [int] NOT NULL ,) ON [PRIMARY]GOALTER TABLE [dbo].[tb_Parent_Role] WITH NOCHECK ADDCONSTRAINT [PK_tb_Parent_Role] PRIMARY KEY CLUSTERED([RoleId],[ParentRoleId]) ON [PRIMARY]GO

View 1 Replies View Related

Selecting All Parents In A Path Enumerated Tree

Jul 20, 2005

Hi,I have a tree structure which is maintained through the use of a pathenumerated column:CREATE TABLE items (item_id NUMERIC NOT NULL,path VARCHAR2(64) NOT NULL);The path is is a colon separated list of ids of the nodes of the tree.So, for example, in this structure:0 -> 1 -> 2 -> 3 -> 4item id 4 would have a path of '0:1:2:3' (0 is the root of allitems, and does not actually exist). Notice that the path does notinclude the item's own id.I would like to select all of the items in a given item's path:SELECT id, path FROM items WHERE id IN (PATH_TO_IDS(path));or maybe:SELECT id, path FROM items WHERE PATH_EQUALS(id, path));or maybe something else altogether. This should return:ITEM_ID PATH------- -------1 02 0:13 0:1:24 0:1:2:3

View 1 Replies View Related

SQL 2012 :: Group By Parent With One Child And Multiple Child Information?

Jul 25, 2014

Basically i have three Tables

Request ID Parent ID Account Name Addresss
1452 1254789 Wendy's Atlanta Georgia
1453 1254789 Wendy's Norcross Georgia
1456 1254789 Waffle House Atlanta Georgia

Bid_ID Bid_Type Bid_Volume Bid_V Bid_D Bid_E Request_ID Parent ID
45897 Incentive 10 N/A N/A N/A 1452 1254789
45898 Incentive 10 N/A N/A N/A 1453 1254789
45899 Incentive 10 N/A N/A N/A 1456 1254789

Bid_Number Bid_Name Request_ID Parent ID
Q789456 Wendy'Off 1452 1254789
Q789457 Wendy'Reba 1452 1254789
Q789456 Wendy'Off 1453 1254789
Q789457 Wendy'Reba 1453 1254789
Q789456 Wendy'Off 1456 1254789

I want the Result

Parent ID Bid_Type Bid_Volume Bid_V Bid_D Bid_E AutoGeneratedCol
1254789 Incentive 10 N/A N/A N/A 1
1254789 Incentive 10 N/A N/A N/A 2
Bid Number AutoGeneratedCol_Link
Q789456 1
Q789457 1
Q789456 2
Request ID AutoGeneratedCol_Link
1452 1
1453 1
1456 2

View 1 Replies View Related

Nested Subreport Causing The Parents Last Header To Expand. Why? How To Fix?

May 10, 2007

I have created a "parent" table with various columns and added an extra detail row to drop a nested subreport into the table passing parameters into the sub in order to obtain the child subreport. The problem is that the the while I can line up the columns in the sub report with the parent report,

I observe something like this:

parent columns:

a b c d e f

child columns

a b c d e f

The problem is in the last column of the parent "f" it appears stretched out for some reason-about an inch even though can grow is set to false.

Its like the child is forcing the parent's last column to expand yet when i observe the border around the table in the child the "f" is clearly more narrow than the parent's f despite my matching the column widths in the layout exactly the same . In preview mode, the parent's last column is extended width-about an inch more was added. Note I tested it with No data in the child's last column and it still expands the parent column by that inch.

Also note when I dropped the subreport into the parent report I'm merging the cells on the detail row that the subreport fits across columns a, b, c, d, e, f.

So even though the subreports data lines up properly under a, b, c, d, and e; the parent's "f" still expands outward.

Any clues or suggests on what I should consider changing. I'm stumped.

View 1 Replies View Related

Child,chid Of Child ,child Of Child Of Child

Oct 22, 2007

 
 
............child  |parent|.............a1     |a     | .............a2     |a     |.............a11   |a1    |.............b1     |b     |.............b11   |b1    |.............b111 |b1    |.............
Here is my table I want to get all childs of "a" ie {a1,a11,a2}I mean recursivelyie child,chid of child ,child of child of child ........etc up to any extentet the table containHow can i for mulate the select   querry?

View 3 Replies View Related

Transact SQL :: To Get Parent / Child / Grand Child Row On Various Order?

Jun 26, 2015

I have a table with below kind of data,

DECLARE @TBL TABLE (ItemId INT IDENTITY(1,1), ItemName NVARCHAR(20), ItemDate DATE, ParentItemName NVARCHAR(20), ItemOrder INT, ReportId INT)
INSERT INTO @TBL (ItemName, ItemDate, ParentItemName, ItemOrder, ReportId)
VALUES ('Plan', '2015-06-01', NULL, 1, 20),('Design', '2015-06-01', NULL, 2, 20),('Test', '2015-06-20', NULL, 3, 20),('Complete', '2015-06-30', NULL, 4, 20),
('Design child A', '2015-06-02', 'Design', 1, 20), ('Design child B', '2015-06-01', 'Design', 2, 20),
('Test child A', '2015-06-10', 'Test', 1, 20), ('Test child B', '2015-06-09', 'Test', 2, 20), ('Test child C', '2015-06-08', 'Test', 3, 20),
('Test grand child A', '2015-06-08', 'Test child B', 1, 20), ('Test grand child B', '2015-06-08', 'Test child B', 2, 20)
select * from @TBL

Here I want,

1. to display all parent with ORDER BY ItemOrder (no need to sort by ItemDate)
2. display all child row right after their parent (ORDER BY ItemOrder if ItemDate are same, else ORDER BY ItemDate)
3. display all grand child row right after their parent (ORDER BY ItemOrder if ItemDate are same, else ORDER BY ItemDate)

Looking for below output ...

View 3 Replies View Related

Hierarchical (tree) Data Structure Where A Node Can Have Multiple Parents

May 9, 2008

Hi all!
I am trying to organize a hierarchical data structure into a table. I need to have the possibility to set 2 parents for some nodes. Curently I see following two options:
Example 1
id    parent_id    name-----------------------------------1     0                 Level 1 Parent A2     0                 Level 1 Parent B3     1,2              Level 2 Child
Example 2
id    parent_id    name-----------------------------------1     0                 Level 1 Parent A2     0                 Level 1 Parent B3     1                 Level 2 Child3     2                 Level 2 Child
Is any of the two examples valid database logic wise? In fact, is it possible to achieve the requirement by using only one table?
Thanks in advance,

View 4 Replies View Related

How Can I Append Children To Parents In A SSIS Data Flow Task?

Apr 11, 2007

I need to extract data to send to an external agency in their supplied format. The data is normalised in our system in a one to many relationship. The external agency needs it denormalised.



In our system, the parent p has p_id, p_attribute_1, p_attribute_2, p_attribute_3 and the child has c_id, c_attribute_a, c_attribute_b, c_parent_id_fk



The external agency can only use a delimited file looking like

p_id, p_attribute_1, p_attribute_2, p_attribute_3, c1_attribute_a, c1_attribute_b, c2_attribute_a, c2_attribute_b, ...., cn_attribute_a, cn_attribute_b



where n is the number of children a parent may have. Each parent can have 0 or more children - typically between 1 and 20.



How can I achieve this using SSIS? In the past I have used custom built VB apps with the ADO SHAPE command but this is not ideal as I have to rebuild each time to alter the selection criteria and and VB is not a good SQL tool.

View 4 Replies View Related

Trying To Return A Single Record For Each Client From Child Table Based Upon A Field Of Date Type In Child Table

Nov 1, 2007

I have table "Clients" who have associated records in table "Mailings"
I want to populate a gridview using a single query that grabs all the info I need so that I may utilize the gridview's built in sorting.
I'm trying to return records containing the next upcoming mailing for each client.
 
The closest I can get is below:
I'm using GROUP BY because it allows me to return a single record for each client and the MIN part allows me to return the associated record in the mailings table for each client that contains the next upcoming 'send_date' 
 
SELECT MIN(dbo.tbl_clients.client_last_name) AS exp_last_name, MIN(dbo.tbl_mailings.send_date) AS exp_send_date, MIN(dbo.tbl_mailings.user_id) AS exp_user_id, dbo.tbl_clients.client_id, MIN(dbo.tbl_mailings.mailing_id) AS exp_mailing_idFROM dbo.tbl_clients INNER JOIN
dbo.tbl_mailings ON dbo.tbl_clients.client_id = dbo.tbl_mailings.client_idWHERE (dbo.tbl_mailings.user_id = 1000)GROUP BY dbo.tbl_clients.client_id
The user_id set at 1000 part is what makes it rightly pull in all clients for a particular user. Problem is, by using the GROUP BY statement I'm just getting the lowest 'mailing_id' number and NOT the actual entry associated with mailing item I want to return.  Same goes for the last_name field.   Perhaps I need to have a subquery within my WHERE clause?Or am I barking up the wrong tree entirely..

View 7 Replies View Related

Error While Creating Inline Function - CREATE FUNCTION Failed Because A Column Name Is Not Specified For Column 1.

Apr 3, 2007



Hi,



I am trying to create a inline function which is listed below.



USE [Northwind]

SET ANSI_NULLS ON

GO

CREATE FUNCTION newIdentity()

RETURNS TABLE

AS

RETURN

(SELECT ident_current('orders'))

GO



while executing this function in sql server 2005 my get this error

CREATE FUNCTION failed because a column name is not specified for column 1.



Pleae help me to fix this error



thanks

Purnima

View 3 Replies View Related

Creating A Column.

Dec 27, 2006

Is there a way for me to create a column in SQL?
What Im looking to do is create a view with columns from a specific table. In addition to this I would like to append a column to the view which would contain data based on the data from a pre-existing column.
Table AColumn 1Column 2Column 3
View AColumn 1Column 2Column 3Column 4
Now here is the Row structureColumn 1   Column 2   Column 3   Column 4Test           Test          A               ONTest           Test          B               OFF
So if Column 3 contains "A" as its field data than Column 4 will contain "ON" and if Column 3 contains "B" than Column 4 will contain "OFF"
Is this possible?
TIA,
Stue.

View 4 Replies View Related

Transact SQL :: Parent / Child Tables - Pivot Child Data To Parent Row

May 19, 2015

Given the sample data and query below, I would like to know if it is possible to have the outcome be a single row, with the ChildTypeId, c.StartDate, c.EndDate being contained in the parent row.  So, the outcome I'm hoping for based on the data below for ParentId = 1 would be:

1 2015-01-01 2015-12-31 AA 2015-01-01 2015-03-31 BB 2016-01-01 2016-03-31 CC 2017-01-01 2017-03-31 DD 2017-01-01 2017-03-31

declare @parent table (Id int not null primary key, StartDate date, EndDate date)
declare @child table (Id int not null primary key, ParentId int not null, ChildTypeId char(2) not null, StartDate date, EndDate date)
insert @parent select 1, '1/1/2015', '12/31/2015'
insert @child select 1, 1, 'AA', '1/1/2015', '3/31/2015'

[Code] .....

View 6 Replies View Related

Creating A Composite Column

Jul 18, 2005

I have several tables where I have used the command
distinct first_name, last_name, dob
to unduplicate.

I was wondering if I could create a new column in my table that combines the existing records for first_name, last_name and dob?

View 4 Replies View Related

Creating Number Column

May 14, 2008

I have a ACTION column. i.e Its only disply SELL/BUY.

ACTION

BUY
BUY
BUY
SELL
SELL
SELL
SELL
BUY
BUY
SELL
SELL
SELL
BUY

How to create another column display like this

ACTION

BUY 1
BUY 2
BUY 3
SELL 1
SELL 2
SELL 3
SELL 4
BUY 1
BUY 2
SELL 1
SELL 2
SELL 3
BUY 1

Help me anyone...

View 9 Replies View Related

Creating Number Column

May 14, 2008

I have a ACTION column. i.e Its only disply SELL/BUY.

ACTION

BUY
BUY
BUY
SELL
SELL
SELL
SELL
BUY
BUY
SELL
SELL
SELL
BUY

How to create another column display like this

ACTION

BUY 1
BUY 2
BUY 3
SELL 1
SELL 2
SELL 3
SELL 4
BUY 1
BUY 2
SELL 1
SELL 2
SELL 3
BUY 1

Help me anyone...

View 2 Replies View Related

Creating A View With A New Column

Jan 31, 2014

I'm using SQL Server 2008 to solve the following exercise.

I have three Tables:
Table CUSTOMER with columns: CustomerID,Company,ContactName,Phone
Table ORDER with columns: OrderID,OrderDate,ShippedDate,ShipperID,Freight,CustomerID
Table Shipper with columns:ShipperID,Company,Phone

I need to Create a view listing the shipper and the number of unshipped orders. I have been trying to use joins or possibly subqueries, but I'm not getting a correct result for a ShipperID with NO unshipped orders.My view should looks like: ShipperID, Company, Phone, UnshippedOrders

View 4 Replies View Related

Creating A New Column In A Table

Jan 25, 2006

I have created new columns fields in a table using EManager. However, I am wondering Which command do we use to create columns through the analyser??? Is it the same like the "Insert into"?

View 3 Replies View Related

Creating A New Column Of Differences (x[2]-x[1])

Apr 7, 2008

I have a table that looks like this:

id, x
1 9.5
2 10
3 11
...
n x

and what I would like is to update this table with the differences of values in the x column (x[2]-x[1]) where the first difference would just be defined as 0.

result table would look like this:

id, x, dx
1 9.5 0 (where dx[1] defined to be 0)
2 10 0.5 (where dx[2] = 10-9.5 = 0.5)
3 11 1.0 (where dx[3]= 11-10 = 1.0)
...

Any suggestions on the best way to do this?

View 9 Replies View Related

Creating A Key Column For A Table

Jan 11, 2008

Hello,

I'm just using SSIS to build my first data warehouse. I've read quite a bit, but I'm stuck at the very first task: I need to assign a key column (just an int that starts at 1 and basically numbers the rows). What transformation do I use? I was going to use the derived column, but if that's the case, I don't know the script for the expression to do it. If I'm right, would someone mind supplying that also?

Thanks a lot,
Andy

View 4 Replies View Related

Reporting Services :: SSRS Recursive Parent Gives Distinct Children Only When Children Have Multiple Parents

Aug 18, 2015

I have made an SSRS report using the recursive parent functionality to show a hierarchical tree of values. The problem I have is that some children have more than one parent, but because (in order to use the recursive parent nicely) I need to group the results by Id, I only see distinct entries. This means that I only see each child once, even if it "should" appear in multiple locations in the report (under each of its parents).

View 6 Replies View Related

Why Do We Need To Collate One Column While Creating Table?

Apr 21, 2008

Hi,Good morning to All.
I have some doubt.I cannot do anything without knowing the reason why we are doing that particular thing.
Any way, my doubt is:
While creating table, in some places I see COLLATE clause.
For example, recently I have seen this.
CREATE TABLE dbo.OrderDetails(       OrderDetailID INT IDENTITY(1,1) NOT NULL,       ItemNumber VARCHAR(20) COLLATE SQL_Latin1_General_CP1_CI_As NULL,       Qty INT NULL)ON [PRIMARY]
In the above table, why the Collate clause for ItemNumber column? What is the advantage with that clause?I have seen sql server help for this. I have found 1011 results for the query SELECT * FROM fn_helpcollations().Then I searched for SQL_Latin related collations using: SELECT * FROM fn_helpcollations() where name like 'SQL_Latin%'I have found 31 results.How can I know which clause i have to use for which type of query?
Can anybody please tell answers for all these doubts?
Thanks in advance.
Regards,Ashok kumar.

View 1 Replies View Related

Creating An Identity Column In A View

Mar 25, 2004

I need a view that will:
1) select the distinct values in a column (the easy part)
2) assign the equivalent of an identity column to each row containing the distinct value it returns.

For example TableA contains 25 records but one of the columns only contains three unique values (say, 'A','B', & 'C').

This is what I want my view to return:

1 A
2 B
3 C

In other words, I need the view to assign the 1, 2 and 3 to the individual rows.

Thanks in advance for any pointers on this one.

View 4 Replies View Related

T-SQL (SS2K8) :: Creating A Custom Column?

May 14, 2014

creating a custom column that will put a list of 5 values for each unique value(or in this case Employee).

So I have a Employee table were I pull a list of all active employees -

Example -

024Swanson, Ronrswanson@tv.com
026Donaughy, Jackjdonaughy@tv.com
028Scott, Michaelsmichael@tv.com

What I want to do is add a column that has 5 values and create a row for each value

I want it too look like this -

024Swanson, Ronrswanson@tv.com a
024Swanson, Ronrswanson@tv.com b
024Swanson, Ronrswanson@tv.com c
024Swanson, Ronrswanson@tv.com d
024Swanson, Ronrswanson@tv.com e

[Code] ....

Currently all my query looks like is this -

SELECT EmpID, LastFirst, Email
FROM dbo.EmpList
WHERE (Active = 1)

View 4 Replies View Related

Can I Increment The Column (c1+2) ---by Creating The Trigger

Mar 10, 2006

hi,i am a beginner to ms sql server2000i have a tablecreate table ddd (a int, b int)by table structure is a bnow when i enter a value in b column suppose '2' in column bbext time when i insert a value in the column a i have to get the valuein b as 3 is thi spossible with triggersinsert into gdg values (1,2)a b1 2insert into gdg (a) values(2)a b2 3----------------> i have to get this 3 automaticallyis there any method to get thispls help mesatish

View 1 Replies View Related

Creating Primary Key On Nullable Column

Feb 29, 2008

Hello,

I am trying to recreate a primary key that I dropped in a table....

I'm using a statement like

ALTER TABLE temp WITH NOCHECK add CONSTRAINT PK__tempkey PRIMARY KEY CLUSTERED

(

num,
store
)


But apparently the "store" column was created without a "not null" and it let it create the PK during the table creation but now it won't let me add the PK with that nullable column..

Does anyone know how to get it to use that column to create a primary key after the initial table creation?

Here is the error i get

Cannot define PRIMARY KEY constraint on nullable column in table


Thanks a lot

View 5 Replies View Related







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