From: aspfun via SQLMonster.com on
I need to declare a table variable from another existing table.
If I use "Script table as" will create table variable with [], like
CREATE TABLE [dbo].[CLAIM](
[CLAIMNO] [varchar](20) NOT NULL,
[ACCT] [varchar](4) NOT NULL,
....
Is there a function can return script without [ ]?

--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/201005/1

From: TheSQLGuru on
1) it is simple enough to replace [ and ] with empty string in your text
editor.

2) I believe that under Tools:Options:scripting you can set lots of things
about generated scripts.

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net


"aspfun via SQLMonster.com" <u53138(a)uwe> wrote in message
news:a830740748b9f(a)uwe...
>I need to declare a table variable from another existing table.
> If I use "Script table as" will create table variable with [], like
> CREATE TABLE [dbo].[CLAIM](
> [CLAIMNO] [varchar](20) NOT NULL,
> [ACCT] [varchar](4) NOT NULL,
> ...
> Is there a function can return script without [ ]?
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/201005/1
>


From: Erland Sommarskog on
aspfun via SQLMonster.com (u53138(a)uwe) writes:
> I need to declare a table variable from another existing table.
> If I use "Script table as" will create table variable with [], like
> CREATE TABLE [dbo].[CLAIM](
> [CLAIMNO] [varchar](20) NOT NULL,
> [ACCT] [varchar](4) NOT NULL,
> ...
> Is there a function can return script without [ ]?

Unfortunately, there is no option to add [] only when needed.


--
Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx