C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » SQL Server »

Create Table


Posted Date: 06 Nov 2009      Posted By: mallik      Member Level: Bronze     Points: 1   Responses: 6



Hi,
can any body help me how to create a table, i have the fields empno, ename, sal, dept.i need to create the table for the above fields, i have created another table like create table dept (id int, deptname varchar).The data in the dept table like 1. manager
2. assistant manager
3. clark......but in my first table the date type for the dept should be from the second table like create table emp (empno int, ename varchar, sal int, dept (here i need to take from the second table)) plz help me how to write the table.....

awaiting for ur reply.





Responses

Author: dom    06 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

sample:
create table tablename
(
empno int,
ename varchar(max),
sal numeric,
dept varchar(max)

)



Author: Hari    06 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

Hi,

Can we really do that?Having a table as a column in another table??Wow!!



Author: pradeep kumar reddy    06 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

sample:
create table tablename
(
empno int,
ename varchar(max),
sal numeric,
dept varchar(max)

)



by using this syntax we can create a table
all the best



Author: Shameer    08 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

CREATE TABLE emp
(
empno int,
ename varchar(255),
sal int,
dept varchar(255)
)

I think this would help you. If not please let me know..



Author: sudha    12 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

I think this stuff may be not possible.


Author: mithun    12 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

create table emp
(
empno int not null auto_increment,
ename varchar(255) not null,
sal int not null,
dept varchar(255) not null
foreign key(dept) references dept (deptname)
);


de thin s u hav 2 set primary key for deptname in dept(table),den u can use dis query..



@MALLIK
simple...



Post Reply
You must Sign In to post a response.
Next : How to write a Query on table
Previous : Can i call a stored procedure in a function
Return to Discussion Forum
Post New Message
Category: SQL Server

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use