PC Review


Reply
Thread Tools Rate Thread

about create table in sqlcommand

 
 
miladhatam@gmail.com
Guest
Posts: n/a
 
      1st Feb 2007
hi
i know how can i create a table with sql command
but i don't know how create a field with type integer ,autoNumber
(auto increase) and Primary key
Like id field in Access

may you change below code with add a field with above properties
Create Table " + TextBox1.Text + "(tex varchar ,topic
varchar(25)PRIMARY KEY)
thanks

 
Reply With Quote
 
 
 
 
=?Utf-8?B?YnJpYW5zW01DU0Rd?=
Guest
Posts: n/a
 
      1st Feb 2007
Hello miladhatam,

What I think you're asking is how to create a table with a primary key that
is also an identity column. The following statement creates the MyCustomers
table with a CustID field/column as the primary key as an IDENTITY integer
which starts at 100 and increases at an increment of 1. It also has a
CompanyName column. Check out SQL Online Books:

CREATE TABLE MyCustomers (CustID INTEGER IDENTITY (100,1) PRIMARY KEY,
CompanyName NvarChar (50))

--
brians
http://www.limbertech.com


"(E-Mail Removed)" wrote:

> hi
> i know how can i create a table with sql command
> but i don't know how create a field with type integer ,autoNumber
> (auto increase) and Primary key
> Like id field in Access
>
> may you change below code with add a field with above properties
> Create Table " + TextBox1.Text + "(tex varchar ,topic
> varchar(25)PRIMARY KEY)
> thanks
>
>

 
Reply With Quote
 
miladhatam@gmail.com
Guest
Posts: n/a
 
      1st Feb 2007

brians لنشتم است:
> Hello miladhatam,
>
> What I think you're asking is how to create a table with a primary key that
> is also an identity column. The following statement creates the MyCustomers
> table with a CustID field/column as the primary key as an IDENTITY integer
> which starts at 100 and increases at an increment of 1. It also has a
> CompanyName column. Check out SQL Online Books:
>
> CREATE TABLE MyCustomers (CustID INTEGER IDENTITY (100,1) PRIMARY KEY,
> CompanyName NvarChar (50))
>
> --
> brians
> http://www.limbertech.com
>
>
> "(E-Mail Removed)" wrote:
>
> > hi
> > i know how can i create a table with sql command
> > but i don't know how create a field with type integer ,autoNumber
> > (auto increase) and Primary key
> > Like id field in Access
> >
> > may you change below code with add a field with above properties
> > Create Table " + TextBox1.Text + "(tex varchar ,topic
> > varchar(25)PRIMARY KEY)
> > thanks
> >
> >

oh thanks
i find this code
id INT NOT NULL IDENTITY PRIMARY KEY ,tex varchar ,topic varchar(25))
but your code is better

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call SqlCommand.ExecuteReader inside another SqlCommand.ExecuteRea =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= Microsoft ADO .NET 9 25th Jan 2007 04:57 PM
How can I create an XMLDocument from SqlCommand.ExecuteXmlReader =?Utf-8?B?RGF2ZSBCb2Fs?= Microsoft Dot NET Framework 2 23rd Sep 2004 10:33 PM
Re: How can I create an XMLDataDocument from SqlCommand.ExecuteXmlRead Sijin Joseph Microsoft Dot NET Framework 1 28th Aug 2004 12:33 AM
System Error Executing CREATE PROCEDURE Script with SqlCommand Marvin Addison Microsoft ADO .NET 3 8th Nov 2003 02:24 AM
Generated create scripts don't work in SqlCommand.ExecuteNonQuery() James Cadd Microsoft ADO .NET 1 25th Aug 2003 01:00 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:31 PM.