Showing posts with label command. Show all posts
Showing posts with label command. Show all posts

Thursday, March 29, 2012

alternate to DBCC command

Hi ,
Is Yukon not supporting all dbcc commands or if they are used they are not
reliable .
If its not supporting where do I find the alternate DMVs for the same .
Thanks
ARR
All documented DBCC commands in Yukon are backwards-compatible and are
supported. Some, such as INDEXDEFRAG and SHOWCONTIG have been deprecated
and have enhanced Yukon equivalents in the syntax (ALTER INDEX for
INDEXDEFRAG) or in the DMV catalog (such as dm_db_index_physical_stats). As
always, undocumented DBCC commands are not supported and we reserve the
right to alter or completely remove them at any time. Can you tell us what
piece of information you're looking for specifically?
Thanks,
Ryan Stonecipher
Microsoft SQL Server Storage Engine, DBCC
This posting is provided "AS IS" with no warranties, and confers no rights.
"Aju" <ajuonline@.yahoo.com> wrote in message
news:ebf1qrpAFHA.1260@.TK2MSFTNGP12.phx.gbl...
> Hi ,
> Is Yukon not supporting all dbcc commands or if they are used they are not
> reliable .
> If its not supporting where do I find the alternate DMVs for the same .
>
> Thanks
> ARR
>
|||Thanks for the reply .
am looking for all documented DBCC command alternative .
Also looking for some difference between sql2000 sysobjects & Yukon . Do you
have any whitepaper for the same . Currently yukon has 46 DMVs but am not
getting info about all those . Please help for the same .
Thanks
ARR
"Ryan Stonecipher [MSFT]" <ryanston@.microsoft.com> wrote in message
news:em2jKzpAFHA.3492@.TK2MSFTNGP12.phx.gbl...
> All documented DBCC commands in Yukon are backwards-compatible and are
> supported. Some, such as INDEXDEFRAG and SHOWCONTIG have been deprecated
> and have enhanced Yukon equivalents in the syntax (ALTER INDEX for
> INDEXDEFRAG) or in the DMV catalog (such as dm_db_index_physical_stats).
As
> always, undocumented DBCC commands are not supported and we reserve the
> right to alter or completely remove them at any time. Can you tell us
what
> piece of information you're looking for specifically?
> Thanks,
> Ryan Stonecipher
> Microsoft SQL Server Storage Engine, DBCC
> This posting is provided "AS IS" with no warranties, and confers no
rights.[vbcol=seagreen]
> "Aju" <ajuonline@.yahoo.com> wrote in message
> news:ebf1qrpAFHA.1260@.TK2MSFTNGP12.phx.gbl...
not
>
|||All the documented DBCC commands are reliable and none have alternatives in
Yukon except for the two that Ryan mentions below. What do you mean when you
say they're 'not reliable' and why do you want alternatives for the
operations they perform?
The DMVs will be fully documented in the BOL for Beta 3.
Regards.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Aju" <ajuonline@.yahoo.com> wrote in message
news:OhBU2gqAFHA.608@.TK2MSFTNGP15.phx.gbl...
> Thanks for the reply .
> am looking for all documented DBCC command alternative .
> Also looking for some difference between sql2000 sysobjects & Yukon . Do
you[vbcol=seagreen]
> have any whitepaper for the same . Currently yukon has 46 DMVs but am not
> getting info about all those . Please help for the same .
> Thanks
> ARR
> "Ryan Stonecipher [MSFT]" <ryanston@.microsoft.com> wrote in message
> news:em2jKzpAFHA.3492@.TK2MSFTNGP12.phx.gbl...
deprecated[vbcol=seagreen]
> As
> what
> rights.
> not
..
>

alternate to DBCC command

Hi ,
Is Yukon not supporting all dbcc commands or if they are used they are not
reliable .
If its not supporting where do I find the alternate DMVs for the same .
Thanks
ARRAll documented DBCC commands in Yukon are backwards-compatible and are
supported. Some, such as INDEXDEFRAG and SHOWCONTIG have been deprecated
and have enhanced Yukon equivalents in the syntax (ALTER INDEX for
INDEXDEFRAG) or in the DMV catalog (such as dm_db_index_physical_stats). As
always, undocumented DBCC commands are not supported and we reserve the
right to alter or completely remove them at any time. Can you tell us what
piece of information you're looking for specifically?
Thanks,
Ryan Stonecipher
Microsoft SQL Server Storage Engine, DBCC
This posting is provided "AS IS" with no warranties, and confers no rights.
"Aju" <ajuonline@.yahoo.com> wrote in message
news:ebf1qrpAFHA.1260@.TK2MSFTNGP12.phx.gbl...
> Hi ,
> Is Yukon not supporting all dbcc commands or if they are used they are not
> reliable .
> If its not supporting where do I find the alternate DMVs for the same .
>
> Thanks
> ARR
>|||Thanks for the reply .
am looking for all documented DBCC command alternative .
Also looking for some difference between sql2000 sysobjects & Yukon . Do you
have any whitepaper for the same . Currently yukon has 46 DMVs but am not
getting info about all those . Please help for the same .
Thanks
ARR
"Ryan Stonecipher [MSFT]" <ryanston@.microsoft.com> wrote in message
news:em2jKzpAFHA.3492@.TK2MSFTNGP12.phx.gbl...
> All documented DBCC commands in Yukon are backwards-compatible and are
> supported. Some, such as INDEXDEFRAG and SHOWCONTIG have been deprecated
> and have enhanced Yukon equivalents in the syntax (ALTER INDEX for
> INDEXDEFRAG) or in the DMV catalog (such as dm_db_index_physical_stats).
As
> always, undocumented DBCC commands are not supported and we reserve the
> right to alter or completely remove them at any time. Can you tell us
what
> piece of information you're looking for specifically?
> Thanks,
> Ryan Stonecipher
> Microsoft SQL Server Storage Engine, DBCC
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Aju" <ajuonline@.yahoo.com> wrote in message
> news:ebf1qrpAFHA.1260@.TK2MSFTNGP12.phx.gbl...
> > Hi ,
> > Is Yukon not supporting all dbcc commands or if they are used they are
not
> > reliable .
> > If its not supporting where do I find the alternate DMVs for the same .
> >
> >
> > Thanks
> > ARR
> >
> >
>|||All the documented DBCC commands are reliable and none have alternatives in
Yukon except for the two that Ryan mentions below. What do you mean when you
say they're 'not reliable' and why do you want alternatives for the
operations they perform?
The DMVs will be fully documented in the BOL for Beta 3.
Regards.
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Aju" <ajuonline@.yahoo.com> wrote in message
news:OhBU2gqAFHA.608@.TK2MSFTNGP15.phx.gbl...
> Thanks for the reply .
> am looking for all documented DBCC command alternative .
> Also looking for some difference between sql2000 sysobjects & Yukon . Do
you
> have any whitepaper for the same . Currently yukon has 46 DMVs but am not
> getting info about all those . Please help for the same .
> Thanks
> ARR
> "Ryan Stonecipher [MSFT]" <ryanston@.microsoft.com> wrote in message
> news:em2jKzpAFHA.3492@.TK2MSFTNGP12.phx.gbl...
> > All documented DBCC commands in Yukon are backwards-compatible and are
> > supported. Some, such as INDEXDEFRAG and SHOWCONTIG have been
deprecated
> > and have enhanced Yukon equivalents in the syntax (ALTER INDEX for
> > INDEXDEFRAG) or in the DMV catalog (such as dm_db_index_physical_stats).
> As
> > always, undocumented DBCC commands are not supported and we reserve the
> > right to alter or completely remove them at any time. Can you tell us
> what
> > piece of information you're looking for specifically?
> >
> > Thanks,
> > Ryan Stonecipher
> > Microsoft SQL Server Storage Engine, DBCC
> >
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> >
> > "Aju" <ajuonline@.yahoo.com> wrote in message
> > news:ebf1qrpAFHA.1260@.TK2MSFTNGP12.phx.gbl...
> > > Hi ,
> > > Is Yukon not supporting all dbcc commands or if they are used they are
> not
> > > reliable .
> > > If its not supporting where do I find the alternate DMVs for the same
.
> > >
> > >
> > > Thanks
> > > ARR
> > >
> > >
> >
> >
>

alternate to DBCC command

Hi ,
Is Yukon not supporting all dbcc commands or if they are used they are not
reliable .
If its not supporting where do I find the alternate DMVs for the same .
Thanks
ARRAll documented DBCC commands in Yukon are backwards-compatible and are
supported. Some, such as INDEXDEFRAG and SHOWCONTIG have been deprecated
and have enhanced Yukon equivalents in the syntax (ALTER INDEX for
INDEXDEFRAG) or in the DMV catalog (such as dm_db_index_physical_stats). As
always, undocumented DBCC commands are not supported and we reserve the
right to alter or completely remove them at any time. Can you tell us what
piece of information you're looking for specifically?
Thanks,
Ryan Stonecipher
Microsoft SQL Server Storage Engine, DBCC
This posting is provided "AS IS" with no warranties, and confers no rights.
"Aju" <ajuonline@.yahoo.com> wrote in message
news:ebf1qrpAFHA.1260@.TK2MSFTNGP12.phx.gbl...
> Hi ,
> Is Yukon not supporting all dbcc commands or if they are used they are not
> reliable .
> If its not supporting where do I find the alternate DMVs for the same .
>
> Thanks
> ARR
>|||Thanks for the reply .
am looking for all documented DBCC command alternative .
Also looking for some difference between sql2000 sysobjects & Yukon . Do you
have any whitepaper for the same . Currently yukon has 46 DMVs but am not
getting info about all those . Please help for the same .
Thanks
ARR
"Ryan Stonecipher [MSFT]" <ryanston@.microsoft.com> wrote in message
news:em2jKzpAFHA.3492@.TK2MSFTNGP12.phx.gbl...
> All documented DBCC commands in Yukon are backwards-compatible and are
> supported. Some, such as INDEXDEFRAG and SHOWCONTIG have been deprecated
> and have enhanced Yukon equivalents in the syntax (ALTER INDEX for
> INDEXDEFRAG) or in the DMV catalog (such as dm_db_index_physical_stats).
As
> always, undocumented DBCC commands are not supported and we reserve the
> right to alter or completely remove them at any time. Can you tell us
what
> piece of information you're looking for specifically?
> Thanks,
> Ryan Stonecipher
> Microsoft SQL Server Storage Engine, DBCC
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Aju" <ajuonline@.yahoo.com> wrote in message
> news:ebf1qrpAFHA.1260@.TK2MSFTNGP12.phx.gbl...
not[vbcol=seagreen]
>|||All the documented DBCC commands are reliable and none have alternatives in
Yukon except for the two that Ryan mentions below. What do you mean when you
say they're 'not reliable' and why do you want alternatives for the
operations they perform?
The DMVs will be fully documented in the BOL for Beta 3.
Regards.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Aju" <ajuonline@.yahoo.com> wrote in message
news:OhBU2gqAFHA.608@.TK2MSFTNGP15.phx.gbl...
> Thanks for the reply .
> am looking for all documented DBCC command alternative .
> Also looking for some difference between sql2000 sysobjects & Yukon . Do
you
> have any whitepaper for the same . Currently yukon has 46 DMVs but am not
> getting info about all those . Please help for the same .
> Thanks
> ARR
> "Ryan Stonecipher [MSFT]" <ryanston@.microsoft.com> wrote in message
> news:em2jKzpAFHA.3492@.TK2MSFTNGP12.phx.gbl...
deprecated[vbcol=seagreen]
> As
> what
> rights.
> not
.[vbcol=seagreen]
>

Sunday, March 25, 2012

Altering a column on a replicated table

Tom,
nice that someone read it
If you're running these commands as a script, you'll need
a GO after each command, otherwise you can just run them
individually one-by-one.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
OK, that worked and I saw the queue reader agent process the commands and
the distribution agent's last action taken now reads "The initial snapshot
for article 'RequistionDetail' is not yet available'.
Now what do I need to do to generate a new snapshot of this one article in
order to get these changes to propogate over to the my subscriber?
Thanks-Tom
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:0f4b01c51511$e4181ce0$a401280a@.phx.gbl...
> Tom,
> nice that someone read it
> If you're running these commands as a script, you'll need
> a GO after each command, otherwise you can just run them
> individually one-by-one.
> Rgds,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
|||Tom,
why are you using , @.force_reinit_subscription = 1?
Ordinarily this is left out and there is no invalidation
of the snapshot - the changes are propagated as a result
of the sp_repl... commands using hte existing replication
framework. If you want to snapshot the table then have a
look at the other method in the article where you drop
the subscription to the article then drop the article.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

ALTER USER WITH LOGIN

What's the syntax to use the ALTER USER command to remap an orphaned user to
an existing login in SS2005?It should be:
ALTER USER user_name WITH LOGIN = login_name
Replace the <user_name> and <login_name> accordingly with the orphaned user
and the existing login.
HTH,
Plamen Ratchev
http://www.SQLStudio.com|||Do you know about the "sp_change_users_login" sp?
You can check it out from the following link if you don't.
http://technet.microsoft.com/en-us/...y/ms174378.aspx
Ekrem ?nsoy
"ken s" <kens@.discussions.microsoft.com> wrote in message
news:8C6629E3-C7D7-467A-A54E-0D9DC5F480F9@.microsoft.com...
> What's the syntax to use the ALTER USER command to remap an orphaned user
> to
> an existing login in SS2005?|||The only catch is it that sp_change_users_login works only for SQL Server
logins, while ALTER USER WITH LOGIN supports both SQL Server and Windows
logins.
Plamen Ratchev
http://www.SQLStudio.comsql

ALTER USER WITH LOGIN

What's the syntax to use the ALTER USER command to remap an orphaned user to
an existing login in SS2005?It should be:
ALTER USER user_name WITH LOGIN = login_name
Replace the <user_name> and <login_name> accordingly with the orphaned user
and the existing login.
HTH,
Plamen Ratchev
http://www.SQLStudio.com|||Do you know about the "sp_change_users_login" sp?
You can check it out from the following link if you don't.
http://technet.microsoft.com/en-us/library/ms174378.aspx
--
Ekrem Ã?nsoy
"ken s" <kens@.discussions.microsoft.com> wrote in message
news:8C6629E3-C7D7-467A-A54E-0D9DC5F480F9@.microsoft.com...
> What's the syntax to use the ALTER USER command to remap an orphaned user
> to
> an existing login in SS2005?|||The only catch is it that sp_change_users_login works only for SQL Server
logins, while ALTER USER WITH LOGIN supports both SQL Server and Windows
logins.
Plamen Ratchev
http://www.SQLStudio.com|||Yup, I already know that but Ken did not mention this need. I did not need
to mentioned this catch because it's already declared in the link I gave.
Alternative is alternative.
--
Ekrem Önsoy
"Plamen Ratchev" <Plamen@.SQLStudio.com> wrote in message
news:15E92A6A-2E39-40B8-A9F9-0F90007BB3D7@.microsoft.com...
> The only catch is it that sp_change_users_login works only for SQL Server
> logins, while ALTER USER WITH LOGIN supports both SQL Server and Windows
> logins.
> Plamen Ratchev
> http://www.SQLStudio.com|||That worked fine on my development machine, but on the server I get this error:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'psts_web'.
Here's the code I tried to run:
ALTER USER psts_web WITH LOGIN psts_web
"psts_web" is the user name and the login name and they both exist in the db.
Thanks
/Ken|||Hi Ken,
You used incorrect syntax. It should be:
ALTER USER psts_web WITH LOGIN = psts_web
Note the part "... LOGIN = psts_web", you were missing the "=".
HTH,
Plamen Ratchev
http://www.SQLStudio.com

ALTER USER WITH LOGIN

What's the syntax to use the ALTER USER command to remap an orphaned user to
an existing login in SS2005?
It should be:
ALTER USER user_name WITH LOGIN = login_name
Replace the <user_name> and <login_name> accordingly with the orphaned user
and the existing login.
HTH,
Plamen Ratchev
http://www.SQLStudio.com
|||Do you know about the "sp_change_users_login" sp?
You can check it out from the following link if you don't.
http://technet.microsoft.com/en-us/library/ms174378.aspx
Ekrem ?nsoy
"ken s" <kens@.discussions.microsoft.com> wrote in message
news:8C6629E3-C7D7-467A-A54E-0D9DC5F480F9@.microsoft.com...
> What's the syntax to use the ALTER USER command to remap an orphaned user
> to
> an existing login in SS2005?
|||The only catch is it that sp_change_users_login works only for SQL Server
logins, while ALTER USER WITH LOGIN supports both SQL Server and Windows
logins.
Plamen Ratchev
http://www.SQLStudio.com
|||Yup, I already know that but Ken did not mention this need. I did not need
to mentioned this catch because it's already declared in the link I gave.
Alternative is alternative.
Ekrem nsoy
"Plamen Ratchev" <Plamen@.SQLStudio.com> wrote in message
news:15E92A6A-2E39-40B8-A9F9-0F90007BB3D7@.microsoft.com...
> The only catch is it that sp_change_users_login works only for SQL Server
> logins, while ALTER USER WITH LOGIN supports both SQL Server and Windows
> logins.
> Plamen Ratchev
> http://www.SQLStudio.com
|||That worked fine on my development machine, but on the server I get this error:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'psts_web'.
Here's the code I tried to run:
ALTER USER psts_web WITH LOGIN psts_web
"psts_web" is the user name and the login name and they both exist in the db.
Thanks
/Ken
|||Hi Ken,
You used incorrect syntax. It should be:
ALTER USER psts_web WITH LOGIN = psts_web
Note the part "... LOGIN = psts_web", you were missing the "=".
HTH,
Plamen Ratchev
http://www.SQLStudio.com

Alter Table with Variables

Hey Guys,
IS possible that I use the command alter table using only variables ?
ie : alter table @.tabelname add @.columname @.datatype
any example how to do that ?
(ive declared the variables)
Tks
Felipe TonioliThis thread on dynamic sql was pretty good:



The post by AjarnMark on Dec 26, 2001 has a couple good references.|||Tks bcr, i already found this topic and Im using the solution now !

Really tks for you help ..

Alter table with Merge replication

Hi,
I have SQL server 2000 merge replication environment.
How can i propagate Add default constraint command on an existing
column withuot runnning the command on every subscriber.
I know i can use sp_repladdcolumn to add a column in the publisher and
let it propaget to all the subscribers, i want the same behaviour but
this time i am only adding a default constraint.
Thanks in Advance.
Check out sp_addscriptexec in the SQL BOL.
HTH
Jerry
<bimalfernando@.gmail.com> wrote in message
news:1127788017.704066.291960@.o13g2000cwo.googlegr oups.com...
> Hi,
> I have SQL server 2000 merge replication environment.
> How can i propagate Add default constraint command on an existing
> column withuot runnning the command on every subscriber.
> I know i can use sp_repladdcolumn to add a column in the publisher and
> let it propaget to all the subscribers, i want the same behaviour but
> this time i am only adding a default constraint.
> Thanks in Advance.
>

Alter table with Merge replication

Hi,
I have SQL server 2000 merge replication environment.
How can i propagate Add default constraint command on an existing
column withuot runnning the command on every subscriber.
I know i can use sp_repladdcolumn to add a column in the publisher and
let it propaget to all the subscribers, i want the same behaviour but
this time i am only adding a default constraint.
Thanks in Advance.Check out sp_addscriptexec in the SQL BOL.
HTH
Jerry
<bimalfernando@.gmail.com> wrote in message
news:1127788017.704066.291960@.o13g2000cwo.googlegroups.com...
> Hi,
> I have SQL server 2000 merge replication environment.
> How can i propagate Add default constraint command on an existing
> column withuot runnning the command on every subscriber.
> I know i can use sp_repladdcolumn to add a column in the publisher and
> let it propaget to all the subscribers, i want the same behaviour but
> this time i am only adding a default constraint.
> Thanks in Advance.
>

Alter table with Merge replication

Hi,
I have SQL server 2000 merge replication environment.
How can i propagate Add default constraint command on an existing
column withuot runnning the command on every subscriber.
I know i can use sp_repladdcolumn to add a column in the publisher and
let it propaget to all the subscribers, i want the same behaviour but
this time i am only adding a default constraint.
Thanks in Advance.Check out sp_addscriptexec in the SQL BOL.
HTH
Jerry
<bimalfernando@.gmail.com> wrote in message
news:1127788017.704066.291960@.o13g2000cwo.googlegroups.com...
> Hi,
> I have SQL server 2000 merge replication environment.
> How can i propagate Add default constraint command on an existing
> column withuot runnning the command on every subscriber.
> I know i can use sp_repladdcolumn to add a column in the publisher and
> let it propaget to all the subscribers, i want the same behaviour but
> this time i am only adding a default constraint.
> Thanks in Advance.
>

Thursday, March 22, 2012

ALTER TABLE SQL7

I used this command on SQL2K to change the length of a column from 150 to
200
ALTER TABLE REPFAX ALTER COLUMN EMAIL VARCHAR(200)
I've tried all vesions and perversions of it on SQL7 but keep gettign the
error that there is something wrong around COLUMN
David A. BeckDavid,
Please include the text of the message that you are getting.
Russell Fields
"David A. Beck" <davidb@.beckb.com> wrote in message
news:OeSw$Oc6DHA.2572@.TK2MSFTNGP09.phx.gbl...
> I used this command on SQL2K to change the length of a column from 150 to
> 200
> ALTER TABLE REPFAX ALTER COLUMN EMAIL VARCHAR(200)
> I've tried all vesions and perversions of it on SQL7 but keep gettign the
> error that there is something wrong around COLUMN
> David A. Beck
>|||Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'COLUMN'.
"Russell Fields" <RussellFields@.NoMailPlease.Com> wrote in message
news:OwHAJic6DHA.696@.tk2msftngp13.phx.gbl...
> David,
> Please include the text of the message that you are getting.
> Russell Fields
> "David A. Beck" <davidb@.beckb.com> wrote in message
> news:OeSw$Oc6DHA.2572@.TK2MSFTNGP09.phx.gbl...
> > I used this command on SQL2K to change the length of a column from 150
to
> > 200
> > ALTER TABLE REPFAX ALTER COLUMN EMAIL VARCHAR(200)
> > I've tried all vesions and perversions of it on SQL7 but keep gettign
the
> > error that there is something wrong around COLUMN
> >
> > David A. Beck
> >
> >
>|||Is the database set to 6.5 compability?
"David A. Beck" <davidb@.beckb.com> wrote in message
news:%23lTlDlc6DHA.2576@.TK2MSFTNGP11.phx.gbl...
> Server: Msg 170, Level 15, State 1, Line 1
> Line 1: Incorrect syntax near 'COLUMN'.
>
> "Russell Fields" <RussellFields@.NoMailPlease.Com> wrote in message
> news:OwHAJic6DHA.696@.tk2msftngp13.phx.gbl...
> > David,
> >
> > Please include the text of the message that you are getting.
> >
> > Russell Fields
> > "David A. Beck" <davidb@.beckb.com> wrote in message
> > news:OeSw$Oc6DHA.2572@.TK2MSFTNGP09.phx.gbl...
> > > I used this command on SQL2K to change the length of a column from 150
> to
> > > 200
> > > ALTER TABLE REPFAX ALTER COLUMN EMAIL VARCHAR(200)
> > > I've tried all vesions and perversions of it on SQL7 but keep gettign
> the
> > > error that there is something wrong around COLUMN
> > >
> > > David A. Beck
> > >
> > >
> >
> >
>|||Yes it is.
"Scott Morris" <bogus@.bogus.com> wrote in message
news:uUJU%23sc6DHA.2908@.tk2msftngp13.phx.gbl...
> Is the database set to 6.5 compability?
> "David A. Beck" <davidb@.beckb.com> wrote in message
> news:%23lTlDlc6DHA.2576@.TK2MSFTNGP11.phx.gbl...
> > Server: Msg 170, Level 15, State 1, Line 1
> > Line 1: Incorrect syntax near 'COLUMN'.
> >
> >
> > "Russell Fields" <RussellFields@.NoMailPlease.Com> wrote in message
> > news:OwHAJic6DHA.696@.tk2msftngp13.phx.gbl...
> > > David,
> > >
> > > Please include the text of the message that you are getting.
> > >
> > > Russell Fields
> > > "David A. Beck" <davidb@.beckb.com> wrote in message
> > > news:OeSw$Oc6DHA.2572@.TK2MSFTNGP09.phx.gbl...
> > > > I used this command on SQL2K to change the length of a column from
150
> > to
> > > > 200
> > > > ALTER TABLE REPFAX ALTER COLUMN EMAIL VARCHAR(200)
> > > > I've tried all vesions and perversions of it on SQL7 but keep
gettign
> > the
> > > > error that there is something wrong around COLUMN
> > > >
> > > > David A. Beck
> > > >
> > > >
> > >
> > >
> >
> >
>|||That's the problem. ALTER support was introduced with v7.
"David A. Beck" <davidb@.beckb.com> wrote in message
news:umAJ7yc6DHA.2628@.TK2MSFTNGP10.phx.gbl...
> Yes it is.
> "Scott Morris" <bogus@.bogus.com> wrote in message
> news:uUJU%23sc6DHA.2908@.tk2msftngp13.phx.gbl...
> > Is the database set to 6.5 compability?
> >
> > "David A. Beck" <davidb@.beckb.com> wrote in message
> > news:%23lTlDlc6DHA.2576@.TK2MSFTNGP11.phx.gbl...
> > > Server: Msg 170, Level 15, State 1, Line 1
> > > Line 1: Incorrect syntax near 'COLUMN'.
> > >
> > >
> > > "Russell Fields" <RussellFields@.NoMailPlease.Com> wrote in message
> > > news:OwHAJic6DHA.696@.tk2msftngp13.phx.gbl...
> > > > David,
> > > >
> > > > Please include the text of the message that you are getting.
> > > >
> > > > Russell Fields
> > > > "David A. Beck" <davidb@.beckb.com> wrote in message
> > > > news:OeSw$Oc6DHA.2572@.TK2MSFTNGP09.phx.gbl...
> > > > > I used this command on SQL2K to change the length of a column from
> 150
> > > to
> > > > > 200
> > > > > ALTER TABLE REPFAX ALTER COLUMN EMAIL VARCHAR(200)
> > > > > I've tried all vesions and perversions of it on SQL7 but keep
> gettign
> > > the
> > > > > error that there is something wrong around COLUMN
> > > > >
> > > > > David A. Beck
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||Scott, thanks. The light went on when I read your question. I did change it
and it works. Thanks so much.
David A. Beck
"Scott Morris" <bogus@.bogus.com> wrote in message
news:epMcOFd6DHA.1752@.tk2msftngp13.phx.gbl...
> That's the problem. ALTER support was introduced with v7.
> "David A. Beck" <davidb@.beckb.com> wrote in message
> news:umAJ7yc6DHA.2628@.TK2MSFTNGP10.phx.gbl...
> > Yes it is.
> >
> > "Scott Morris" <bogus@.bogus.com> wrote in message
> > news:uUJU%23sc6DHA.2908@.tk2msftngp13.phx.gbl...
> > > Is the database set to 6.5 compability?
> > >
> > > "David A. Beck" <davidb@.beckb.com> wrote in message
> > > news:%23lTlDlc6DHA.2576@.TK2MSFTNGP11.phx.gbl...
> > > > Server: Msg 170, Level 15, State 1, Line 1
> > > > Line 1: Incorrect syntax near 'COLUMN'.
> > > >
> > > >
> > > > "Russell Fields" <RussellFields@.NoMailPlease.Com> wrote in message
> > > > news:OwHAJic6DHA.696@.tk2msftngp13.phx.gbl...
> > > > > David,
> > > > >
> > > > > Please include the text of the message that you are getting.
> > > > >
> > > > > Russell Fields
> > > > > "David A. Beck" <davidb@.beckb.com> wrote in message
> > > > > news:OeSw$Oc6DHA.2572@.TK2MSFTNGP09.phx.gbl...
> > > > > > I used this command on SQL2K to change the length of a column
from
> > 150
> > > > to
> > > > > > 200
> > > > > > ALTER TABLE REPFAX ALTER COLUMN EMAIL VARCHAR(200)
> > > > > > I've tried all vesions and perversions of it on SQL7 but keep
> > gettign
> > > > the
> > > > > > error that there is something wrong around COLUMN
> > > > > >
> > > > > > David A. Beck
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||what errors do you get?
"David A. Beck" <davidb@.beckb.com> wrote in message
news:OeSw$Oc6DHA.2572@.TK2MSFTNGP09.phx.gbl...
> I used this command on SQL2K to change the length of a column from 150 to
> 200
> ALTER TABLE REPFAX ALTER COLUMN EMAIL VARCHAR(200)
> I've tried all vesions and perversions of it on SQL7 but keep gettign the
> error that there is something wrong around COLUMN
> David A. Beck
>|||Richard:
Please read further up the string. I already answered that. The problem was
that the database was set to 6.5 compatability. Thanks.
"Richard Ding" <dingr@.cleanharbors.com> wrote in message
news:uzq1qmm6DHA.2720@.TK2MSFTNGP09.phx.gbl...
> what errors do you get?
> "David A. Beck" <davidb@.beckb.com> wrote in message
> news:OeSw$Oc6DHA.2572@.TK2MSFTNGP09.phx.gbl...
> > I used this command on SQL2K to change the length of a column from 150
to
> > 200
> > ALTER TABLE REPFAX ALTER COLUMN EMAIL VARCHAR(200)
> > I've tried all vesions and perversions of it on SQL7 but keep gettign
the
> > error that there is something wrong around COLUMN
> >
> > David A. Beck
> >
> >
>

ALTER TABLE SQL7

I used this command on SQL2K to change the length of a column from 150 to
200
ALTER TABLE REPFAX ALTER COLUMN EMAIL VARCHAR(200)
I've tried all vesions and perversions of it on SQL7 but keep gettign the
error that there is something wrong around COLUMN
David A. BeckDavid,
Please include the text of the message that you are getting.
Russell Fields
"David A. Beck" <davidb@.beckb.com> wrote in message
news:OeSw$Oc6DHA.2572@.TK2MSFTNGP09.phx.gbl...
quote:

> I used this command on SQL2K to change the length of a column from 150 to
> 200
> ALTER TABLE REPFAX ALTER COLUMN EMAIL VARCHAR(200)
> I've tried all vesions and perversions of it on SQL7 but keep gettign the
> error that there is something wrong around COLUMN
> David A. Beck
>
|||Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'COLUMN'.
"Russell Fields" <RussellFields@.NoMailPlease.Com> wrote in message
news:OwHAJic6DHA.696@.tk2msftngp13.phx.gbl...
quote:

> David,
> Please include the text of the message that you are getting.
> Russell Fields
> "David A. Beck" <davidb@.beckb.com> wrote in message
> news:OeSw$Oc6DHA.2572@.TK2MSFTNGP09.phx.gbl...
to[QUOTE]
the[QUOTE]
>
|||Is the database set to 6.5 compability?
"David A. Beck" <davidb@.beckb.com> wrote in message
news:%23lTlDlc6DHA.2576@.TK2MSFTNGP11.phx.gbl...
quote:

> Server: Msg 170, Level 15, State 1, Line 1
> Line 1: Incorrect syntax near 'COLUMN'.
>
> "Russell Fields" <RussellFields@.NoMailPlease.Com> wrote in message
> news:OwHAJic6DHA.696@.tk2msftngp13.phx.gbl...
> to
> the
>
|||Yes it is.
"Scott Morris" <bogus@.bogus.com> wrote in message
news:uUJU%23sc6DHA.2908@.tk2msftngp13.phx.gbl...
quote:

> Is the database set to 6.5 compability?
> "David A. Beck" <davidb@.beckb.com> wrote in message
> news:%23lTlDlc6DHA.2576@.TK2MSFTNGP11.phx.gbl...
150[QUOTE]
gettign[QUOTE]
>
|||That's the problem. ALTER support was introduced with v7.
"David A. Beck" <davidb@.beckb.com> wrote in message
news:umAJ7yc6DHA.2628@.TK2MSFTNGP10.phx.gbl...
quote:

> Yes it is.
> "Scott Morris" <bogus@.bogus.com> wrote in message
> news:uUJU%23sc6DHA.2908@.tk2msftngp13.phx.gbl...
> 150
> gettign
>
|||Scott, thanks. The light went on when I read your question. I did change it
and it works. Thanks so much.
David A. Beck
"Scott Morris" <bogus@.bogus.com> wrote in message
news:epMcOFd6DHA.1752@.tk2msftngp13.phx.gbl...
quote:

> That's the problem. ALTER support was introduced with v7.
> "David A. Beck" <davidb@.beckb.com> wrote in message
> news:umAJ7yc6DHA.2628@.TK2MSFTNGP10.phx.gbl...
from[QUOTE]
>
|||what errors do you get?
"David A. Beck" <davidb@.beckb.com> wrote in message
news:OeSw$Oc6DHA.2572@.TK2MSFTNGP09.phx.gbl...
quote:

> I used this command on SQL2K to change the length of a column from 150 to
> 200
> ALTER TABLE REPFAX ALTER COLUMN EMAIL VARCHAR(200)
> I've tried all vesions and perversions of it on SQL7 but keep gettign the
> error that there is something wrong around COLUMN
> David A. Beck
>
|||Richard:
Please read further up the string. I already answered that. The problem was
that the database was set to 6.5 compatability. Thanks.
"Richard Ding" <dingr@.cleanharbors.com> wrote in message
news:uzq1qmm6DHA.2720@.TK2MSFTNGP09.phx.gbl...
quote:

> what errors do you get?
> "David A. Beck" <davidb@.beckb.com> wrote in message
> news:OeSw$Oc6DHA.2572@.TK2MSFTNGP09.phx.gbl...
to[QUOTE]
the[QUOTE]
>
sql

Alter table Question in Sql 2000

How to add multiple columns with alter table command in Sql 2000 ?

ALTER TABLE [deneme].[dbo].[Mudurluk]
ADD HarcamaYetkilisi varchar(50) COLLATE Turkish_CI_AS NULL

//below gives error
ADD MaliKontrolYetkilisi varchar(50) COLLATE Turkish_CI_AS NULL ,
ADD Memur varchar(50) COLLATE Turkish_CI_AS NULL ,
ADD Sef varchar(50) COLLATE Turkish_CI_AS NULL ,
ADD MuhasebeYetkilisiYardimcisi varchar(50) COLLATE Turkish_CI_AS NULL

Can you help me with this ?

Thanks alot in advance

Specify ADD only the first time.

Alter Table Question

I'm setting up a DTS to modify a table, and I need to "reset" the identity
field. I had originally wanted to do this with an ALTER TABLE command, but
apparently it isn't as straightforward as that. So at this point I believe
I need to drop the table and recreate it. Is this the case? Assuming it
is, I've run into the following problem. I need to add a description to the
fields when I re-create the table, but I can't seem to find the syntax. For
my CREATE function, it's as simple as:
CREATE TABLE TstTable
(
ACC_ID int identity primary key,
Code varchar(50),
CodeType varchar(15),
ActionType varchar(10),
ActionBy varchar(50),
ChangeDate datetime,
ChangeTime varchar(20)
)
...but I can't figure out how to put a description for each field in.
Anyone know the syntax, or if it's impossible?
Thanks,
James
Nevermind...seems like sp_addextendedproperty will do what I'm looking for.
Thanks anyway!
"James" <cppjames@.aol.com> wrote in message
news:eYEmV862EHA.2192@.TK2MSFTNGP14.phx.gbl...
> I'm setting up a DTS to modify a table, and I need to "reset" the identity
> field. I had originally wanted to do this with an ALTER TABLE command,
but
> apparently it isn't as straightforward as that. So at this point I
believe
> I need to drop the table and recreate it. Is this the case? Assuming it
> is, I've run into the following problem. I need to add a description to
the
> fields when I re-create the table, but I can't seem to find the syntax.
For
> my CREATE function, it's as simple as:
> CREATE TABLE TstTable
> (
> ACC_ID int identity primary key,
> Code varchar(50),
> CodeType varchar(15),
> ActionType varchar(10),
> ActionBy varchar(50),
> ChangeDate datetime,
> ChangeTime varchar(20)
> )
> ...but I can't figure out how to put a description for each field in.
> Anyone know the syntax, or if it's impossible?
> Thanks,
> James
>
|||James -
Have a look at dbcc checkident for the other issue of resetting the
identity.
Mike John
"James" <cppjames@.aol.com> wrote in message
news:OE4FGA72EHA.1192@.tk2msftngp13.phx.gbl...
> Nevermind...seems like sp_addextendedproperty will do what I'm looking
> for.
> Thanks anyway!
>
> "James" <cppjames@.aol.com> wrote in message
> news:eYEmV862EHA.2192@.TK2MSFTNGP14.phx.gbl...
> but
> believe
> the
> For
>

Tuesday, March 20, 2012

ALTER table command

Hi,

I'm trying to run the ALTER TABLE command using a dynamic string for the
table, like so:

DECLARE @.TableName CHAR
SET @.TableName = 'Customers'
ALTER TABLE @.TableName
ADD ...blah

Is this possible? We know this works:

ALTER TABLE Customers ADD ...blah

It looks like I need a way to convert the CHAR value to a literal or perhaps
even a table ID?

Thanks in advance,
PaulYou would need to use dynamic query...

e.g.
exec('alter table '+@.tb+' add blah')

--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net

"Paul Sampson" <psampson@.uecomm.com.au> wrote in message
news:1061964209.790366@.proxy.uecomm.net.au...
> Hi,
> I'm trying to run the ALTER TABLE command using a dynamic string for the
> table, like so:
> DECLARE @.TableName CHAR
> SET @.TableName = 'Customers'
> ALTER TABLE @.TableName
> ADD ...blah
> Is this possible? We know this works:
> ALTER TABLE Customers ADD ...blah
> It looks like I need a way to convert the CHAR value to a literal or
perhaps
> even a table ID?
> Thanks in advance,
> Paul|||"Paul Sampson" <psampson@.uecomm.com.au> wrote in message news:<1061964209.790366@.proxy.uecomm.net.au>...
> Hi,
> I'm trying to run the ALTER TABLE command using a dynamic string for the
> table, like so:
> DECLARE @.TableName CHAR
> SET @.TableName = 'Customers'
> ALTER TABLE @.TableName
> ADD ...blah
> Is this possible? We know this works:
> ALTER TABLE Customers ADD ...blah
> It looks like I need a way to convert the CHAR value to a literal or perhaps
> even a table ID?
> Thanks in advance,
> Paul

You can use dynamic SQL:

declare @.tablename sysname
set @.tablename = 'Customers'
exec('alter table dbo.' + @.tablename + ' add ...')

See here for more information on dynamic SQL:

http://www.algonet.se/~sommar/dynamic_sql.html

By the way, if you declare a variable as CHAR without a length, it
will default to CHAR(1). For object names, sysname is a better choice.

Simon|||Thanks Simon - a common suggestion and one that I'll be sure to remember.

"Simon Hayes" <sql@.hayes.ch> wrote in message
news:60cd0137.0308270337.2bbb79e4@.posting.google.c om...
> "Paul Sampson" <psampson@.uecomm.com.au> wrote in message
news:<1061964209.790366@.proxy.uecomm.net.au>...
> > Hi,
> > I'm trying to run the ALTER TABLE command using a dynamic string for the
> > table, like so:
> > DECLARE @.TableName CHAR
> > SET @.TableName = 'Customers'
> > ALTER TABLE @.TableName
> > ADD ...blah
> > Is this possible? We know this works:
> > ALTER TABLE Customers ADD ...blah
> > It looks like I need a way to convert the CHAR value to a literal or
perhaps
> > even a table ID?
> > Thanks in advance,
> > Paul
> You can use dynamic SQL:
> declare @.tablename sysname
> set @.tablename = 'Customers'
> exec('alter table dbo.' + @.tablename + ' add ...')
> See here for more information on dynamic SQL:
> http://www.algonet.se/~sommar/dynamic_sql.html
> By the way, if you declare a variable as CHAR without a length, it
> will default to CHAR(1). For object names, sysname is a better choice.
> Simon

Alter table and size changes

Question that I hope someone can direct me.
I do alter table command to (mostly) add columns to an existing table,
but sometimes to change the size of an existing column (such as char(30)
changing to char(50)).
I remember reading that changing the sze will actually leave the 30
character area and add at the end the 50 character, so the table is
taking up 80 characters instead of 50 (if this is wrong let me know).
So I am thinking I need to do a command that compares the size of the
existing table with the size of the table if it had been created
correctly using the create table command. How can I do that or is it
necessary?
Thanks.
Darin
*** Sent via Developersdex http://www.examnotes.net ***Hi, Darin
This happens only for fixed-length datatypes (for example char, but not
varchar). You can look at the xoffset column in sysobjects to see the
difference.
Try this, for example:
CREATE TABLE T1 (X char(1000), Y char(500))
ALTER TABLE T1 ALTER COLUMN X char(2000)
CREATE TABLE T2 (A char(2000), B char(500))
SELECT o.name as TableName, c.name as ColumnName, c.length, c.xoffset
FROM syscolumns c INNER JOIN sysobjects o ON c.id=o.id
WHERE o.name IN ('T1','T2')
DROP TABLE T1, T2
You will get something like this:
TableName ColumnName length xoffset
-- -- -- --
T1 X 2000 1504
T1 Y 500 1004
T2 A 2000 4
T2 B 500 2004
This may indicate that the row size for T1 is about 3506 bytes, whereas
the row size for T2 is about 2506 bytes.
For more informations, see:
http://www.nigelrivett.net/SQLAdmin...leProblems.html
However, I think you should worry about this problem only if are using
large columns with fixed-length data types. Usually, the large columns
are variable-length data types, i.e. varchar(50), not char(50), so this
is rarely a problem with a big impact.
Razvansql

Monday, March 19, 2012

ALTER TABLE Add <column>

Hi,
I would like to add a column using the ALTER TABLE command. That works fine
and the column is added at the end of the table. But I would prefer if it
was added somewhere in the middle. How could I do that?
Here is my code:
ALTER TABLE bdok_schueler
ADD skz VARCHAR(6);
Thanks,
PhilippI dont think you can specify the position.
There is a good post relating to this here:
http://dbforums.com/arch/72/2003/11/964612
Cheers,
James Goodman MCSE, MCDBA
http://www.angelfire.com/sports/f1pictures|||Hi,
We can not do this from Query Analyzer.
If we do it from Enterprise manager, it actually does below steps,
1. Export the data out
2. Drop the table
3. Create the table (includes the new column based on the location you have
given)
4. Load the data back
Thsi step will take a long time incase the table data size is huge.
Thanks
hari
MCDBA
"Philipp Röthl" <REMOVEphilipp.roethl@.intercom.at> wrote in message
news:40169246@.e-post.inode.at...
> Hi,
> I would like to add a column using the ALTER TABLE command. That works
fine
> and the column is added at the end of the table. But I would prefer if it
> was added somewhere in the middle. How could I do that?
> Here is my code:
> ALTER TABLE bdok_schueler
> ADD skz VARCHAR(6);
> Thanks,
> Philipp
>

ALTER TABLE Add <column>

Hi,
I would like to add a column using the ALTER TABLE command. That works fine
and the column is added at the end of the table. But I would prefer if it
was added somewhere in the middle. How could I do that?
Here is my code:
ALTER TABLE bdok_schueler
ADD skz VARCHAR(6);
Thanks,
PhilippI dont think you can specify the position.
There is a good post relating to this here:
http://mcse.ms/arch/72/2003/11/964612
Cheers,
James Goodman MCSE, MCDBA
http://www.angelfire.com/sports/f1pictures|||Hi,
We can not do this from Query Analyzer.
If we do it from Enterprise manager, it actually does below steps,
1. Export the data out
2. Drop the table
3. Create the table (includes the new column based on the location you have
given)
4. Load the data back
Thsi step will take a long time incase the table data size is huge.
Thanks
hari
MCDBA
"Philipp Rthl" <REMOVEphilipp.roethl@.intercom.at> wrote in message
news:40169246@.e-post.inode.at...
quote:

> Hi,
> I would like to add a column using the ALTER TABLE command. That works

fine
quote:

> and the column is added at the end of the table. But I would prefer if it
> was added somewhere in the middle. How could I do that?
> Here is my code:
> ALTER TABLE bdok_schueler
> ADD skz VARCHAR(6);
> Thanks,
> Philipp
>

ALTER TABLE ... IDENTITY question....

Hi,
I am trying to programatically change the seed of an existing IDENTITY
column (Copy_ID). When I run the following command I get the error:
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'IDENTITY'.
ALTER TABLE Copy ALTER COLUMN Copy_ID Int IDENTITY (1,1);
Where am I going wrong?
Thanks in advance,
StuCheck out DBCC CHECKIDENT in the BOL.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Stu" <s.lock@.cergis.com> wrote in message
news:uGBp9R1RGHA.5500@.TK2MSFTNGP12.phx.gbl...
Hi,
I am trying to programatically change the seed of an existing IDENTITY
column (Copy_ID). When I run the following command I get the error:
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'IDENTITY'.
ALTER TABLE Copy ALTER COLUMN Copy_ID Int IDENTITY (1,1);
Where am I going wrong?
Thanks in advance,
Stu