.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

generate create script of table using c# and SQL server 7.0, can anyone help me?

Posted By:      Posted Date: August 23, 2010    Points: 0   Category :ASP.Net

I want to generate create table script using c#.net, I want to connect sql server 7.0 and generate table create script. Its urgent kindly help me urgently.

View Complete Post

More Related Resource Links

generate Table script using TSQL Sql Server

This code sample helps you to generate the Table script for the particular table. You can create the function and can generate the script by calling the function by passing the Table name as a parameter.

sql server 2005 express - don't allow to create table

i have downloaded sql server 2005 Express version from the web and use domainname\SQLEXPRESS as server name but now i can't create table seems every create by sa user, what is the password of this user or how to grand right to my window login user so that i can modify/create something in database.

How to create a view in my database from a table in another server/database

Is there a way to create a view in my database referencing a table in another server/database if I have the connection information.  I know how to do it in Oracle, simply create a database link, but have never done so in sqlserver.

SMO classes to generate alter table script to add columns

How to generate ALTER TABLE script to add columns using SMO and c#.

unable to create new table in sql server 2000 enterprise manager on windows7(Operating system)

i have successfuly installed sql server 2000 on windows7 and i am able to browse all the tables and edit aswell(on enterprise manager) but i have a problem while creating new tables it says ' MMC has detected an error in a snap-in' and provides options to either continue with the error or send a report to microsoft ,   Please help regarding this compatibility issue   Thanks in advance !

How to create/trigger a server-only script

Background:  I have a site that sends a good bit of emails, some one at a time, and some larger groups of admin emails.  I'm running on a shared hosting service.  The mailserver is horribly slow, so any script that sends a single email can take as much as 15 seconds to execute (and I can't seem to set Response.BufferOutput  to false, so the whole page has to wait the entire duration).  On the bulk emailings, it can take minutes for that to run.I want to create a "mail queue" of my own... I want any script that sends an email to, instead, write a row to a db table containing the necessary email info, which will let the script get on with its business quickly.  Then, I want to create a script that runs on the server only, and have it check the table for emails, send them, and remove them from the table.I know I can have the "mailsender" script run as a scheduled task, and it would thereby run on the server only.  But I would prefer to have the initial script somehow "trigger" the mailsender script.So, QUESTION:  Is there a way in asp.net to create a script that will execute solely on the server, and call that script from another page, so that the calling page doesn't wait for the server script to execute?Thanks!

How to auto create (or Generate a script) which can create indexes on subscriber


In our scenario, subscriber and publishers have same tables and we want the indexes also to be same at all places..

How to auto create (or Generate a script) which can create indexes on subscriber which are already added on publisher.. Is there a auto way or is there any article somewhere which can help..


IMP : There might be a delay in posting replies due to time difference (GMT +2:00) and Friday's Holiday instead of Sunday.

Create table dynamically in SQL Server


hi all,

i want to create temparory table dynamically in sql server,

well, it depends on the fields that are passed from front end as comma seprated value..

and that table shoud contain only that fields that are passed  from front end,

help me on this if it is possible,


Thanx in advance,

Sagar Joshi

SSIS 2005 - Dynamically generate create table statement from source



I have a requirement where i had to migrate the table structure and data from ODBC database to SQL Server. I have dynamic source reader that uses sql query from variable to get the data and the next step is to get the create statement and create table and then to insert data. how can i get Create Statement the destination produces and use sql task to create the table and then insert the data using data flow task.

Please suggest



Adding a new field to a table via script in sql server management studio

I know how you can script to and create a new table but how about adding a new field to this table? For example: how would i add a new varchar(50) field named mynewfield?

USE [example]
/****** Object: Table [dbo].[Password]  Script Date: 10/26/2010 10:17:30 ******/
CREATE TABLE [dbo].[Password](
	[user_id] [int] NOT NULL,
	[password] [varchar](30) COLLATE SQL_Latin1_General_CP850_BIN2 NULL,
	[response1] [varchar](40) COLLATE SQL_Latin1_General_CP850_BIN2 NULL,
	[response2] [varchar](40) COLLATE SQL_Latin1_General_CP850_BIN2 NULL,
	[response3] [varchar](40) COLLATE SQL_Latin1_General_CP850_BIN2 NULL,
	[user_id] ASC

ALTER TABLE [dbo].[Password] WITH CHECK ADD CONSTRAINT [User_Password_FK1] FOREIGN KEY([user_id])
REFERENCES [dbo].[User] ([id])
ALTER TABLE [dbo].[Password] CHECK CONSTRAINT [User_Password_FK1]

Create Table Script



I have the following T-SQL script generated from an existing table:

	[ErrorId] [uniqueidentifier] NOT NULL,
	[Application] [nvarchar](60) NOT NULL,
	[Host] [nvarchar](50) NOT NULL,
	[Type] [nvarchar](100) NOT NULL,
	[Source] [nvarchar](60) NOT NULL,
	[Message] [nvarchar](500) NOT NULL,
	[User] [nvarchar](50) NOT NULL,
	[StatusCode] [int] NOT

create table script



I need a create table script (see bottom), where a field-description will be placed beside every field. In addition the field timestamp should contain the defaultvalue of the current time.

Thanks for your hint.




TABLE dbo.Example




Cannot generate table scripts with DateTime2 datatype in SQL Server 2008


When trying to generate a "CREATE TO" script from a SQL Server 2008 table containing either DATE or DateTime2 data types,  I get the following error:

Script failed for Table 'dbo.tMyTable'.  (Microsoft.SqlServer.Smo)
Column SnapshotDate in object tMyTable contains type DateTime2, which is not supported in the target server version, SQL Server 2005. (Microsoft.SqlServer.Smo)

However, I've checked all my databases (including master, tempdb, etc.) and ALL are cmptlevel=100.


Can not create table via SSMS 2005 GUI even with dbowner rights (I can via ddl script)


I have SQL server 2005 client with SP3 (Microsoft SQL Server Management Studio      9.00.4035.00).

Back end database is SQL server 2008 SP2

I can create/alter a table via sql script.
In the SSMS Database Designer (GUI), When I right click on the database >> Tables and select New Table I get the following error - "Unspecified Error. MS Visual Database Tools."

I was able to use SSMS 2008 client to create tables with out any issues. Looks like a compatibility issue between SSMS 2005 and SS 2008 server.  Has anyone seen this issue and if yes is there a fix for it ?




Can not create table in SQL server 2005 Express


hello !

I have database in SQL server Express 2005,  I just create table Customer and table Employee , table Product .They are OK , I want create table Bill and table DetailBill , but they are wrong,

create table Bill
 IDbill char(10) primary key not null,
 IDcustomer char(10) foreign key(IDcustomer) references Customer(IDcustomer),
 IDemployee char(10) foreign key(IDemployee) references Employee(IDemployee),
 StartBill datetime default getdate() not null,
 EndBill datetime not null
 constraint checkendbill

Connestion string create any database server

This links important to how to create connection string to any data base sever.

Temporary tables in SQL Server vs. table variables

When writing T-SQL code, you often need a table in which to store data temporarily when it comes time to execute that code. You have four table options: normal tables, local temporary tables, global temporary tables and table variables. I'll discuss the differences between using temporary tables in SQL Server versus table variables.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend