Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Wednesday, March 28, 2012

MSSMS templates when creating procs from Object Explorer -vs- Solution Explorer

I'm trying to integrate SSMS into our small IT shop. Having the templates available in MSSMS will help enforce standards.

My question is why can I right click on the stored proc folder in Object Explorer and get the nice template withthe replaceable params but when I right click in the Queries folder of Solution Explorer I only get a blank query window? It seems to me that I should have templates available in SE too.

I add a new (blank) query into the solution, then right-click/copy the appropriate template from the Template Explorer. This can then be pasted into the new query window.

But you're correct, it would be much nicer to be able to "add from template" straight into the solution.

Jamie

|||Thats a great suggestion can you file it on http://connect.microsoft.com?

Wednesday, March 21, 2012

Msg:15335

Server: Msg 15335, Level 11, State 1, Procedure
sp_rename, Line 342
Error: The @.newname value 'BC_SLATFix' is already in use
as a object name and would cause a duplicate that is not
permitted.
Thanks reply
hi,
While using sp_rename stored procedure make sure the value that you are
passing as a new name of the object, does not exists in the database .
Ex:
sp_rename 'old_name,'new_name' --object with the new_name must be existing
in the database.
Vishal Parkar
vgparkar@.yahoo.co.in
sql

Monday, March 12, 2012

Msg 2714

Any idea why I get the following error:
Msg 2714, Level 16, State 1, Line 16
There is already an object named '#errlog' in the database.
when I run the following statement:
IF object_id('tempdb..#errlog') IS NOT NULL
DROP TABLE #errlog
IF @.@.VERSION LIKE '%9.00%'
CREATE TABLE #errlog
(
logdate datetime,
processinfo varchar(50),
logtext varchar(2000)
)
ELSE
CREATE TABLE #errlog
(
errorlog varchar(2000),
c2 int
)
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200604/1Yes...even though you have the logic contract, the
statement will be seen as two create table statements
attempting to create tables of the same name.
One option is to wrap each create table #errlog...etc
statement in an EXEC.
IF @.@.VERSION LIKE '%9.00%'
EXEC ('CREATE TABLE #errlog
(
logdate datetime,
processinfo varchar(50),
logtext varchar(2000)
)')
ELSE
EXEC('CREATE TABLE #errlog1
(
errorlog varchar(2000),
c2 int
)')
-Sue
On Mon, 24 Apr 2006 20:51:52 GMT, "cbrichards" <u3288@.uwe>
wrote:

>Any idea why I get the following error:
>Msg 2714, Level 16, State 1, Line 16
>There is already an object named '#errlog' in the database.
>when I run the following statement:
>IF object_id('tempdb..#errlog') IS NOT NULL
> DROP TABLE #errlog
>IF @.@.VERSION LIKE '%9.00%'
> CREATE TABLE #errlog
> (
> logdate datetime,
> processinfo varchar(50),
> logtext varchar(2000)
> )
>ELSE
> CREATE TABLE #errlog
> (
> errorlog varchar(2000),
> c2 int
> )|||Is that because it is a DDL statement that it nees to be wrapped as such?
Sue Hoegemeier wrote:[vbcol=seagreen]
>Yes...even though you have the logic contract, the
>statement will be seen as two create table statements
>attempting to create tables of the same name.
>One option is to wrap each create table #errlog...etc
>statement in an EXEC.
>IF @.@.VERSION LIKE '%9.00%'
> EXEC ('CREATE TABLE #errlog
> (
> logdate datetime,
> processinfo varchar(50),
> logtext varchar(2000)
> )')
>ELSE
> EXEC('CREATE TABLE #errlog1
> (
> errorlog varchar(2000),
> c2 int
> )')
>-Sue
>
>[quoted text clipped - 18 lines]
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200604/1|||In the original version you had, when parsing or compiling
the query the engine will see two distinct create table
statements trying to create a table of the same name.
If you wrap it in an exec, the engine will use deferred
resolution.
-Sue
On Mon, 24 Apr 2006 22:31:59 GMT, "cbrichards via
droptable.com" <u3288@.uwe> wrote:
[vbcol=seagreen]
>Is that because it is a DDL statement that it nees to be wrapped as such?
>Sue Hoegemeier wrote:|||Why does it see "two distinct create table statements" when it is within an
IF construct? Truly their are two create statements, but the IF is
conditional, correct?
Sue Hoegemeier wrote:[vbcol=seagreen]
>In the original version you had, when parsing or compiling
>the query the engine will see two distinct create table
>statements trying to create a table of the same name.
>If you wrap it in an exec, the engine will use deferred
>resolution.
>-Sue
>
>[quoted text clipped - 25 lines]
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200604/1|||On Wed, 26 Apr 2006 17:19:57 GMT, cbrichards via droptable.com wrote:

>Why does it see "two distinct create table statements" when it is within an
>IF construct? Truly their are two create statements, but the IF is
>conditional, correct?
Hi cbrichards,
At parse and compile time, the batch is scanned from top to bottom,
without checking conditional execution. This check sees two CREATE TABLE
statements and regards that as an error condition.
Hugo Kornelis, SQL Server MVP|||It doesn't know the path for the logic branch until run time
- not at parse or compile time. Consequently it will see two
different create table statements of the same name.
-Sue
On Wed, 26 Apr 2006 17:19:57 GMT, "cbrichards via
droptable.com" <u3288@.uwe> wrote:
[vbcol=seagreen]
>Why does it see "two distinct create table statements" when it is within an
>IF construct? Truly their are two create statements, but the IF is
>conditional, correct?
>Sue Hoegemeier wrote:

Msg 2714

Any idea why I get the following error:
Msg 2714, Level 16, State 1, Line 16
There is already an object named '#errlog' in the database.
when I run the following statement:
IF object_id('tempdb..#errlog') IS NOT NULL
DROP TABLE #errlog
IF @.@.VERSION LIKE '%9.00%'
CREATE TABLE #errlog
(
logdate datetime,
processinfo varchar(50),
logtext varchar(2000)
)
ELSE
CREATE TABLE #errlog
(
errorlog varchar(2000),
c2 int
)
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200604/1Yes...even though you have the logic contract, the
statement will be seen as two create table statements
attempting to create tables of the same name.
One option is to wrap each create table #errlog...etc
statement in an EXEC.
IF @.@.VERSION LIKE '%9.00%'
EXEC ('CREATE TABLE #errlog
(
logdate datetime,
processinfo varchar(50),
logtext varchar(2000)
)')
ELSE
EXEC('CREATE TABLE #errlog1
(
errorlog varchar(2000),
c2 int
)')
-Sue
On Mon, 24 Apr 2006 20:51:52 GMT, "cbrichards" <u3288@.uwe>
wrote:
>Any idea why I get the following error:
>Msg 2714, Level 16, State 1, Line 16
>There is already an object named '#errlog' in the database.
>when I run the following statement:
>IF object_id('tempdb..#errlog') IS NOT NULL
> DROP TABLE #errlog
>IF @.@.VERSION LIKE '%9.00%'
> CREATE TABLE #errlog
> (
> logdate datetime,
> processinfo varchar(50),
> logtext varchar(2000)
> )
>ELSE
> CREATE TABLE #errlog
> (
> errorlog varchar(2000),
> c2 int
> )|||Is that because it is a DDL statement that it nees to be wrapped as such?
Sue Hoegemeier wrote:
>Yes...even though you have the logic contract, the
>statement will be seen as two create table statements
>attempting to create tables of the same name.
>One option is to wrap each create table #errlog...etc
>statement in an EXEC.
>IF @.@.VERSION LIKE '%9.00%'
> EXEC ('CREATE TABLE #errlog
> (
> logdate datetime,
> processinfo varchar(50),
> logtext varchar(2000)
> )')
>ELSE
> EXEC('CREATE TABLE #errlog1
> (
> errorlog varchar(2000),
> c2 int
> )')
>-Sue
>>Any idea why I get the following error:
>>Msg 2714, Level 16, State 1, Line 16
>[quoted text clipped - 18 lines]
>> c2 int
>> )
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200604/1|||In the original version you had, when parsing or compiling
the query the engine will see two distinct create table
statements trying to create a table of the same name.
If you wrap it in an exec, the engine will use deferred
resolution.
-Sue
On Mon, 24 Apr 2006 22:31:59 GMT, "cbrichards via
SQLMonster.com" <u3288@.uwe> wrote:
>Is that because it is a DDL statement that it nees to be wrapped as such?
>Sue Hoegemeier wrote:
>>Yes...even though you have the logic contract, the
>>statement will be seen as two create table statements
>>attempting to create tables of the same name.
>>One option is to wrap each create table #errlog...etc
>>statement in an EXEC.
>>IF @.@.VERSION LIKE '%9.00%'
>> EXEC ('CREATE TABLE #errlog
>> (
>> logdate datetime,
>> processinfo varchar(50),
>> logtext varchar(2000)
>> )')
>>ELSE
>> EXEC('CREATE TABLE #errlog1
>> (
>> errorlog varchar(2000),
>> c2 int
>> )')
>>-Sue
>>Any idea why I get the following error:
>>Msg 2714, Level 16, State 1, Line 16
>>[quoted text clipped - 18 lines]
>> c2 int
>> )|||Why does it see "two distinct create table statements" when it is within an
IF construct? Truly their are two create statements, but the IF is
conditional, correct?
Sue Hoegemeier wrote:
>In the original version you had, when parsing or compiling
>the query the engine will see two distinct create table
>statements trying to create a table of the same name.
>If you wrap it in an exec, the engine will use deferred
>resolution.
>-Sue
>>Is that because it is a DDL statement that it nees to be wrapped as such?
>[quoted text clipped - 25 lines]
>> c2 int
>> )
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200604/1|||On Wed, 26 Apr 2006 17:19:57 GMT, cbrichards via SQLMonster.com wrote:
>Why does it see "two distinct create table statements" when it is within an
>IF construct? Truly their are two create statements, but the IF is
>conditional, correct?
Hi cbrichards,
At parse and compile time, the batch is scanned from top to bottom,
without checking conditional execution. This check sees two CREATE TABLE
statements and regards that as an error condition.
--
Hugo Kornelis, SQL Server MVP|||It doesn't know the path for the logic branch until run time
- not at parse or compile time. Consequently it will see two
different create table statements of the same name.
-Sue
On Wed, 26 Apr 2006 17:19:57 GMT, "cbrichards via
SQLMonster.com" <u3288@.uwe> wrote:
>Why does it see "two distinct create table statements" when it is within an
>IF construct? Truly their are two create statements, but the IF is
>conditional, correct?
>Sue Hoegemeier wrote:
>>In the original version you had, when parsing or compiling
>>the query the engine will see two distinct create table
>>statements trying to create a table of the same name.
>>If you wrap it in an exec, the engine will use deferred
>>resolution.
>>-Sue
>>Is that because it is a DDL statement that it nees to be wrapped as such?
>>[quoted text clipped - 25 lines]
>> c2 int
>> )

Msg 2511

We are getting the following error on our production machine when we run
DBCC CHECKDB
Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
(1:41060), slots 264 and 265.
Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
(1:41085), slots 75 and 76.
Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
(1:41125), slots 15 and 16.
CHECKTABLE found 0 allocation errors and 3 consistency errors in table
'INT_AUX_ACTIVITY' (object ID 1488776411).
repair_rebuild is the minimum repair level for the errors found by DBCC
CHECKTABLE (sca_master.dbo.INT_AUX_ACTIVITY ).
I searched Google and found the following article,
http://www.winnetmag.com/SQLServer/Forums/messageview.cfm?catid=1664&threadid=117814
However, my network admin tells me that he could not find anything wrong
with the server. If drop the index pointed out in the error, dbcc returns no
errors.
If add the index back, I get the errors again.
Did anybody expericence a similar issue. Any pointers would be appreciated.
Thanks.
PrasadUsing SQL 2K, SP3a, with MS03-031.
Using RAID5 for data.
RAM: 2GB
"Prasad Koukuntla" <prasad.koukuntla@.scapromo.com> wrote in message
news:ew6EAWkIEHA.3664@.TK2MSFTNGP11.phx.gbl...
> We are getting the following error on our production machine when we run
> DBCC CHECKDB
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41060), slots 264 and 265.
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41085), slots 75 and 76.
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41125), slots 15 and 16.
> CHECKTABLE found 0 allocation errors and 3 consistency errors in table
> 'INT_AUX_ACTIVITY' (object ID 1488776411).
> repair_rebuild is the minimum repair level for the errors found by DBCC
> CHECKTABLE (sca_master.dbo.INT_AUX_ACTIVITY ).
> I searched Google and found the following article,
>
http://www.winnetmag.com/SQLServer/Forums/messageview.cfm?catid=1664&threadid=117814
> However, my network admin tells me that he could not find anything wrong
> with the server. If drop the index pointed out in the error, dbcc returns
no
> errors.
> If add the index back, I get the errors again.
> Did anybody expericence a similar issue. Any pointers would be
appreciated.
> Thanks.
> Prasad
>|||I ran dbcc checktable(int_aux_activity, REPAIR_REBUILD) with no_infomsgs
as suggested in the error. However, the errors still showed up, when I ran
the DBCC CHECKTABLE without the repair option.
"Prasad Koukuntla" <prasad.koukuntla@.scapromo.com> wrote in message
news:ew6EAWkIEHA.3664@.TK2MSFTNGP11.phx.gbl...
> We are getting the following error on our production machine when we run
> DBCC CHECKDB
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41060), slots 264 and 265.
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41085), slots 75 and 76.
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41125), slots 15 and 16.
> CHECKTABLE found 0 allocation errors and 3 consistency errors in table
> 'INT_AUX_ACTIVITY' (object ID 1488776411).
> repair_rebuild is the minimum repair level for the errors found by DBCC
> CHECKTABLE (sca_master.dbo.INT_AUX_ACTIVITY ).
> I searched Google and found the following article,
>
http://www.winnetmag.com/SQLServer/Forums/messageview.cfm?catid=1664&threadid=117814
> However, my network admin tells me that he could not find anything wrong
> with the server. If drop the index pointed out in the error, dbcc returns
no
> errors.
> If add the index back, I get the errors again.
> Did anybody expericence a similar issue. Any pointers would be
appreciated.
> Thanks.
> Prasad
>

Msg 2511

We are getting the following error on our production machine when we run
DBCC CHECKDB
Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
(1:41060), slots 264 and 265.
Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
(1:41085), slots 75 and 76.
Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
(1:41125), slots 15 and 16.
CHECKTABLE found 0 allocation errors and 3 consistency errors in table
'INT_AUX_ACTIVITY' (object ID 1488776411).
repair_rebuild is the minimum repair level for the errors found by DBCC
CHECKTABLE (sca_master.dbo.INT_AUX_ACTIVITY ).
I searched Google and found the following article,
http://www.winnetmag.com/SQLServer/F...hreadid=117814
However, my network admin tells me that he could not find anything wrong
with the server. If drop the index pointed out in the error, dbcc returns no
errors.
If add the index back, I get the errors again.
Did anybody expericence a similar issue. Any pointers would be appreciated.
Thanks.
Prasad
Using SQL 2K, SP3a, with MS03-031.
Using RAID5 for data.
RAM: 2GB
"Prasad Koukuntla" <prasad.koukuntla@.scapromo.com> wrote in message
news:ew6EAWkIEHA.3664@.TK2MSFTNGP11.phx.gbl...
> We are getting the following error on our production machine when we run
> DBCC CHECKDB
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41060), slots 264 and 265.
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41085), slots 75 and 76.
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41125), slots 15 and 16.
> CHECKTABLE found 0 allocation errors and 3 consistency errors in table
> 'INT_AUX_ACTIVITY' (object ID 1488776411).
> repair_rebuild is the minimum repair level for the errors found by DBCC
> CHECKTABLE (sca_master.dbo.INT_AUX_ACTIVITY ).
> I searched Google and found the following article,
>
http://www.winnetmag.com/SQLServer/F...hreadid=117814
> However, my network admin tells me that he could not find anything wrong
> with the server. If drop the index pointed out in the error, dbcc returns
no
> errors.
> If add the index back, I get the errors again.
> Did anybody expericence a similar issue. Any pointers would be
appreciated.
> Thanks.
> Prasad
>
|||I ran dbcc checktable(int_aux_activity, REPAIR_REBUILD) with no_infomsgs
as suggested in the error. However, the errors still showed up, when I ran
the DBCC CHECKTABLE without the repair option.
"Prasad Koukuntla" <prasad.koukuntla@.scapromo.com> wrote in message
news:ew6EAWkIEHA.3664@.TK2MSFTNGP11.phx.gbl...
> We are getting the following error on our production machine when we run
> DBCC CHECKDB
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41060), slots 264 and 265.
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41085), slots 75 and 76.
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41125), slots 15 and 16.
> CHECKTABLE found 0 allocation errors and 3 consistency errors in table
> 'INT_AUX_ACTIVITY' (object ID 1488776411).
> repair_rebuild is the minimum repair level for the errors found by DBCC
> CHECKTABLE (sca_master.dbo.INT_AUX_ACTIVITY ).
> I searched Google and found the following article,
>
http://www.winnetmag.com/SQLServer/F...hreadid=117814
> However, my network admin tells me that he could not find anything wrong
> with the server. If drop the index pointed out in the error, dbcc returns
no
> errors.
> If add the index back, I get the errors again.
> Did anybody expericence a similar issue. Any pointers would be
appreciated.
> Thanks.
> Prasad
>

Msg 2511

We are getting the following error on our production machine when we run
DBCC CHECKDB
Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
(1:41060), slots 264 and 265.
Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
(1:41085), slots 75 and 76.
Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
(1:41125), slots 15 and 16.
CHECKTABLE found 0 allocation errors and 3 consistency errors in table
'INT_AUX_ACTIVITY' (object ID 1488776411).
repair_rebuild is the minimum repair level for the errors found by DBCC
CHECKTABLE (sca_master.dbo.INT_AUX_ACTIVITY ).
I searched Google and found the following article,
http://www.winnetmag.com/SQLServer/...=1178
14
However, my network admin tells me that he could not find anything wrong
with the server. If drop the index pointed out in the error, dbcc returns no
errors.
If add the index back, I get the errors again.
Did anybody expericence a similar issue. Any pointers would be appreciated.
Thanks.
PrasadUsing SQL 2K, SP3a, with MS03-031.
Using RAID5 for data.
RAM: 2GB
"Prasad Koukuntla" <prasad.koukuntla@.scapromo.com> wrote in message
news:ew6EAWkIEHA.3664@.TK2MSFTNGP11.phx.gbl...
> We are getting the following error on our production machine when we run
> DBCC CHECKDB
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41060), slots 264 and 265.
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41085), slots 75 and 76.
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41125), slots 15 and 16.
> CHECKTABLE found 0 allocation errors and 3 consistency errors in table
> 'INT_AUX_ACTIVITY' (object ID 1488776411).
> repair_rebuild is the minimum repair level for the errors found by DBCC
> CHECKTABLE (sca_master.dbo.INT_AUX_ACTIVITY ).
> I searched Google and found the following article,
>
http://www.winnetmag.com/SQLServer/...threadid=117814darkred">
> However, my network admin tells me that he could not find anything wrong
> with the server. If drop the index pointed out in the error, dbcc returns
no
> errors.
> If add the index back, I get the errors again.
> Did anybody expericence a similar issue. Any pointers would be
appreciated.
> Thanks.
> Prasad
>|||I ran dbcc checktable(int_aux_activity, REPAIR_REBUILD) with no_infomsgs
as suggested in the error. However, the errors still showed up, when I ran
the DBCC CHECKTABLE without the repair option.
"Prasad Koukuntla" <prasad.koukuntla@.scapromo.com> wrote in message
news:ew6EAWkIEHA.3664@.TK2MSFTNGP11.phx.gbl...
> We are getting the following error on our production machine when we run
> DBCC CHECKDB
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41060), slots 264 and 265.
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41085), slots 75 and 76.
> Server: Msg 2511, Level 16, State 1, Line 1
> Table error: Object ID 1488776411, Index ID 3. Keys out of order on page
> (1:41125), slots 15 and 16.
> CHECKTABLE found 0 allocation errors and 3 consistency errors in table
> 'INT_AUX_ACTIVITY' (object ID 1488776411).
> repair_rebuild is the minimum repair level for the errors found by DBCC
> CHECKTABLE (sca_master.dbo.INT_AUX_ACTIVITY ).
> I searched Google and found the following article,
>
http://www.winnetmag.com/SQLServer/...threadid=117814darkred">
> However, my network admin tells me that he could not find anything wrong
> with the server. If drop the index pointed out in the error, dbcc returns
no
> errors.
> If add the index back, I get the errors again.
> Did anybody expericence a similar issue. Any pointers would be
appreciated.
> Thanks.
> Prasad
>

Friday, March 9, 2012

msg : 2714

II am trying to create table through Query Analyzer. an error message appears
"Server: Msg 2714, Level 16, State 4, Line 1
There is already an object named 'ACTIVITY_TABLE' in the database."
the table does not exists in the DB I used following scripts to create table
create table dbo.ACTIVITY_TABLE (
ACTIVITY_DEPT_CODE numeric(10) not null,
ACTIVITY_CODE numeric(2) not null,
ACTIVITY_LOCAL_CODE numeric(9) null,
ACTIVITY_DESC varchar(200) null,
CORDINATOR_CODE varchar(50) null,
LASTUSERID varchar(8) not null,
LASTDATE datetime not null,
ACTIVITY_IND varchar(1) null,
constraint ACTIVITY_TABLE primary key (ACTIVITY_DEPT_CODE, ACTIVITY_CODE)
)
GoHi
Rename you constraint to something else. Only 1 object in a DB can have a
specific name. Your Table and your Constraint have the same name which is
not allowed
e.g.
constraint cons_ACTIVITY_TABLE primary key (ACTIVITY_DEPT_CODE,
ACTIVITY_CODE)
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Adel" <Adel@.discussions.microsoft.com> wrote in message
news:3FE4F90F-D387-4F81-9576-51C31C9D79C1@.microsoft.com...
> II am trying to create table through Query Analyzer. an error message
appears
> "Server: Msg 2714, Level 16, State 4, Line 1
> There is already an object named 'ACTIVITY_TABLE' in the database."
> the table does not exists in the DB I used following scripts to create
table
> create table dbo.ACTIVITY_TABLE (
> ACTIVITY_DEPT_CODE numeric(10) not null,
> ACTIVITY_CODE numeric(2) not null,
> ACTIVITY_LOCAL_CODE numeric(9) null,
> ACTIVITY_DESC varchar(200) null,
> CORDINATOR_CODE varchar(50) null,
> LASTUSERID varchar(8) not null,
> LASTDATE datetime not null,
> ACTIVITY_IND varchar(1) null,
> constraint ACTIVITY_TABLE primary key (ACTIVITY_DEPT_CODE,
ACTIVITY_CODE)
> )
> Go
>
>|||Many people use a postscript, or prescript kind of name,,, I would use
Activity_table_PK, so when names are sorted all of the activity-table stuff
sorts together..
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
"Adel" <Adel@.discussions.microsoft.com> wrote in message
news:3FE4F90F-D387-4F81-9576-51C31C9D79C1@.microsoft.com...
> II am trying to create table through Query Analyzer. an error message
> appears
> "Server: Msg 2714, Level 16, State 4, Line 1
> There is already an object named 'ACTIVITY_TABLE' in the database."
> the table does not exists in the DB I used following scripts to create
> table
> create table dbo.ACTIVITY_TABLE (
> ACTIVITY_DEPT_CODE numeric(10) not null,
> ACTIVITY_CODE numeric(2) not null,
> ACTIVITY_LOCAL_CODE numeric(9) null,
> ACTIVITY_DESC varchar(200) null,
> CORDINATOR_CODE varchar(50) null,
> LASTUSERID varchar(8) not null,
> LASTDATE datetime not null,
> ACTIVITY_IND varchar(1) null,
> constraint ACTIVITY_TABLE primary key (ACTIVITY_DEPT_CODE,
> ACTIVITY_CODE)
> )
> Go
>
>