what is the same statment like this "DROP TEMPORARY TABLE IF EXISTS
temp_item" for MS SQL? Does MS SQL have "IF EXISTS" function?
Message posted via http://www.droptable.com
if object_id('tempdb..#temp_item') is not null
drop table #temp_item
AMB
"Grant H via droptable.com" wrote:
> what is the same statment like this "DROP TEMPORARY TABLE IF EXISTS
> temp_item" for MS SQL? Does MS SQL have "IF EXISTS" function?
> --
> Message posted via http://www.droptable.com
>
|||A sample for the employee table in the Northwind database:
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[Employees]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Employees]
GO
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
"Grant H via droptable.com" <forum@.nospam.droptable.com> schrieb im
Newsbeitrag news:1b883ba01f1b4a5481ba1fbd07890119@.droptable.co m...
> what is the same statment like this "DROP TEMPORARY TABLE IF EXISTS
> temp_item" for MS SQL? Does MS SQL have "IF EXISTS" function?
> --
> Message posted via http://www.droptable.com
|||Use Alejandro's example for temp tables, and Jens' example for permanent
tables.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Grant H via droptable.com" <forum@.nospam.droptable.com> wrote in message
news:1b883ba01f1b4a5481ba1fbd07890119@.droptable.co m...
> what is the same statment like this "DROP TEMPORARY TABLE IF EXISTS
> temp_item" for MS SQL? Does MS SQL have "IF EXISTS" function?
> --
> Message posted via http://www.droptable.com
Showing posts with label via. Show all posts
Showing posts with label via. Show all posts
Wednesday, March 28, 2012
IF EXISTS for drop table.
IF EXISTS for drop table.
what is the same statment like this "DROP TEMPORARY TABLE IF EXISTS
temp_item" for MS SQL? Does MS SQL have "IF EXISTS" function?
Message posted via http://www.droptable.comif object_id('tempdb..#temp_item') is not null
drop table #temp_item
AMB
"Grant H via droptable.com" wrote:
> what is the same statment like this "DROP TEMPORARY TABLE IF EXISTS
> temp_item" for MS SQL? Does MS SQL have "IF EXISTS" function?
> --
> Message posted via http://www.droptable.com
>|||A sample for the employee table in the Northwind database:
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[Employees]') and OBJECTPROPERTY(id, N'IsUserTable
') = 1)
drop table [dbo].[Employees]
GO
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Grant H via droptable.com" <forum@.nospam.droptable.com> schrieb im
Newsbeitrag news:1b883ba01f1b4a5481ba1fbd07890119@.SQ
droptable.com...
> what is the same statment like this "DROP TEMPORARY TABLE IF EXISTS
> temp_item" for MS SQL? Does MS SQL have "IF EXISTS" function?
> --
> Message posted via http://www.droptable.com|||Use Alejandro's example for temp tables, and Jens' example for permanent
tables.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Grant H via droptable.com" <forum@.nospam.droptable.com> wrote in message
news:1b883ba01f1b4a5481ba1fbd07890119@.SQ
droptable.com...
> what is the same statment like this "DROP TEMPORARY TABLE IF EXISTS
> temp_item" for MS SQL? Does MS SQL have "IF EXISTS" function?
> --
> Message posted via http://www.droptable.com
temp_item" for MS SQL? Does MS SQL have "IF EXISTS" function?
Message posted via http://www.droptable.comif object_id('tempdb..#temp_item') is not null
drop table #temp_item
AMB
"Grant H via droptable.com" wrote:
> what is the same statment like this "DROP TEMPORARY TABLE IF EXISTS
> temp_item" for MS SQL? Does MS SQL have "IF EXISTS" function?
> --
> Message posted via http://www.droptable.com
>|||A sample for the employee table in the Northwind database:
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[Employees]') and OBJECTPROPERTY(id, N'IsUserTable
') = 1)
drop table [dbo].[Employees]
GO
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Grant H via droptable.com" <forum@.nospam.droptable.com> schrieb im
Newsbeitrag news:1b883ba01f1b4a5481ba1fbd07890119@.SQ
droptable.com...
> what is the same statment like this "DROP TEMPORARY TABLE IF EXISTS
> temp_item" for MS SQL? Does MS SQL have "IF EXISTS" function?
> --
> Message posted via http://www.droptable.com|||Use Alejandro's example for temp tables, and Jens' example for permanent
tables.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Grant H via droptable.com" <forum@.nospam.droptable.com> wrote in message
news:1b883ba01f1b4a5481ba1fbd07890119@.SQ
droptable.com...
> what is the same statment like this "DROP TEMPORARY TABLE IF EXISTS
> temp_item" for MS SQL? Does MS SQL have "IF EXISTS" function?
> --
> Message posted via http://www.droptable.com
Monday, March 26, 2012
IE7 from Windows Update - SRS no longer works
I installed IE7 this morning via Windows Update. Now, I can't get to http://localhost/Reports$sql2005. It just says, "The report server is not responding. Verify that the report server is running and can be accessed from this computer." Currently, I have the default IE7 security settings. Also, I'm running XP with IIS 5.1. Any ideas?
I too had some issues.
By adding my report server site to "Trusted Sites" I was able to navigate to my report server. IE7 has caused me quite a few problems i must admit (like I don't seem to be able to post comments on blogs etc.... I'm gradually working through my list of "issues" with it )
I finally uninstalled SQL Server 2005 and then reinstalled it. Now, everything is back to working.sql
Monday, March 12, 2012
identity on / off
does anyone know syntext to turn on / off Identity field? I usually do this
via EnterpriseMgr but I want to do this via SQL.
You can't 'turn' it on and off.
You can add a new column, transfer data if appropriate, and remove the old
column.
Enterprise Mangler creates a new table and transfers the data from the old
table to the new table. (One of the many reasons that EM is NOT a good tool
to use to manage your databases.)
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"David Kwon" <tjk_guard-msnewsgp@.yahoo.com> wrote in message
news:e0MFUC86GHA.1188@.TK2MSFTNGP05.phx.gbl...
> does anyone know syntext to turn on / off Identity field? I usually do
> this
> via EnterpriseMgr but I want to do this via SQL.
>
>
|||Hi,
To add on, you can not switch of the Identity property using a TSQL. But you
could reseed the identity
value using DBCC CHECKIDENT command.While resseding ensure that primary key
violation will
not happen incase the identity column is associated with PKey.
Thanks
Hari
"Arnie Rowland" <arnie@.1568.com> wrote in message
news:%23yU32r86GHA.4604@.TK2MSFTNGP03.phx.gbl...
> You can't 'turn' it on and off.
> You can add a new column, transfer data if appropriate, and remove the old
> column.
> Enterprise Mangler creates a new table and transfers the data from the old
> table to the new table. (One of the many reasons that EM is NOT a good
> tool to use to manage your databases.)
>
> --
> Arnie Rowland, Ph.D.
> Westwood Consulting, Inc
> Most good judgment comes from experience.
> Most experience comes from bad judgment.
> - Anonymous
> lue "David Kwon" <tjk_guard-msnewsgp@.yahoo.com> wrote in message
> news:e0MFUC86GHA.1188@.TK2MSFTNGP05.phx.gbl...
>
|||"Arnie Rowland" <arnie@.1568.com> wrote in message
news:%23yU32r86GHA.4604@.TK2MSFTNGP03.phx.gbl...
> You can't 'turn' it on and off.
Unless I'm misunderstanding the question, yes you can turn it on and off. I
do it this way:
set identity_insert MyTable on
insert into MyTable
(MyIdentityColumn, MyColumn2, etc... )
values
(Value1, etc... )
set identity_insert MyTable off
--Rob Roberts
via EnterpriseMgr but I want to do this via SQL.
You can't 'turn' it on and off.
You can add a new column, transfer data if appropriate, and remove the old
column.
Enterprise Mangler creates a new table and transfers the data from the old
table to the new table. (One of the many reasons that EM is NOT a good tool
to use to manage your databases.)
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"David Kwon" <tjk_guard-msnewsgp@.yahoo.com> wrote in message
news:e0MFUC86GHA.1188@.TK2MSFTNGP05.phx.gbl...
> does anyone know syntext to turn on / off Identity field? I usually do
> this
> via EnterpriseMgr but I want to do this via SQL.
>
>
|||Hi,
To add on, you can not switch of the Identity property using a TSQL. But you
could reseed the identity
value using DBCC CHECKIDENT command.While resseding ensure that primary key
violation will
not happen incase the identity column is associated with PKey.
Thanks
Hari
"Arnie Rowland" <arnie@.1568.com> wrote in message
news:%23yU32r86GHA.4604@.TK2MSFTNGP03.phx.gbl...
> You can't 'turn' it on and off.
> You can add a new column, transfer data if appropriate, and remove the old
> column.
> Enterprise Mangler creates a new table and transfers the data from the old
> table to the new table. (One of the many reasons that EM is NOT a good
> tool to use to manage your databases.)
>
> --
> Arnie Rowland, Ph.D.
> Westwood Consulting, Inc
> Most good judgment comes from experience.
> Most experience comes from bad judgment.
> - Anonymous
> lue "David Kwon" <tjk_guard-msnewsgp@.yahoo.com> wrote in message
> news:e0MFUC86GHA.1188@.TK2MSFTNGP05.phx.gbl...
>
|||"Arnie Rowland" <arnie@.1568.com> wrote in message
news:%23yU32r86GHA.4604@.TK2MSFTNGP03.phx.gbl...
> You can't 'turn' it on and off.
Unless I'm misunderstanding the question, yes you can turn it on and off. I
do it this way:
set identity_insert MyTable on
insert into MyTable
(MyIdentityColumn, MyColumn2, etc... )
values
(Value1, etc... )
set identity_insert MyTable off
--Rob Roberts
Wednesday, March 7, 2012
Identity Column Property
Hi,
It's my first time here , and my first steps with SqlServer too.
I would like to know if there is a way to check via transact-Sql if a column has Identity Property and if so wat are the the seed and increment values.
Thanks
SanduHere you go for the first one :
How to find whether a column is Identity column
select name from syscolumns where colstat & 1 = 1 and name = @.ColumnName
For the second one ...
IDENT_SEED
Returns the seed value (returned as numeric(@.@.MAXPRECISION,0)) specified during the creation of an identity column in a table or a view that has an identity column.
Syntax
IDENT_SEED ( 'table_or_view' )
IDENT_INCR
Returns the increment value (returned as numeric(@.@.MAXPRECISION,0)) specified during the creation of an identity column in a table or view that has an identity column.
Syntax
IDENT_INCR ( 'table_or_view' )|||Thanks a lot
sandu
It's my first time here , and my first steps with SqlServer too.
I would like to know if there is a way to check via transact-Sql if a column has Identity Property and if so wat are the the seed and increment values.
Thanks
SanduHere you go for the first one :
How to find whether a column is Identity column
select name from syscolumns where colstat & 1 = 1 and name = @.ColumnName
For the second one ...
IDENT_SEED
Returns the seed value (returned as numeric(@.@.MAXPRECISION,0)) specified during the creation of an identity column in a table or a view that has an identity column.
Syntax
IDENT_SEED ( 'table_or_view' )
IDENT_INCR
Returns the increment value (returned as numeric(@.@.MAXPRECISION,0)) specified during the creation of an identity column in a table or view that has an identity column.
Syntax
IDENT_INCR ( 'table_or_view' )|||Thanks a lot
sandu
Subscribe to:
Posts (Atom)