Friday, February 24, 2012
can alter table drop multiple columns
ALTER TABLE RDKCOCUS
DROP COLUMN [Administration Executive],
DROP COLUMN [Administrator],
DROP COLUMN [Auditor],
DROP COLUMN [Chairman],
DROP COLUMN [Chief Executive Officer],
DROP COLUMN [Chief Financial Officer],
DROP COLUMN [Chief Operating Officer],
DROP COLUMN [Co-Chairman/Vice Chairman],
DROP COLUMN [Controller],
DROP COLUMN [Corporate Communications Executive],
DROP COLUMN [Corporate Secretary],
DROP COLUMN [Data Processing Executive],
DROP COLUMN [Director],
DROP COLUMN [Executive Director],
DROP COLUMN [Executive Vice President],
DROP COLUMN [Finance Executive],
DROP COLUMN [General Counsel],
DROP COLUMN [Human Resources Executive],
DROP COLUMN [Manager],
DROP COLUMN [Marketing Executive],
DROP COLUMN [Officer],
DROP COLUMN [Operations Executive],
DROP COLUMN [Owner],
DROP COLUMN [Partner],
DROP COLUMN [Plant Manager],
DROP COLUMN [President],
DROP COLUMN [Principal],
DROP COLUMN [Publisher],
DROP COLUMN [Purchasing Agent],
DROP COLUMN [Sales Executive],
DROP COLUMN [Senior Vice President],
DROP COLUMN [Telecommunications Executive],
DROP COLUMN [Treasurer],
DROP COLUMN [Vice President]
and i got the error, incorrect syntax near keyword drop
so i tried this script instead:
ALTER TABLE RDKCOCUS
DROP COLUMN [Administration Executive]
and it worked. so i guess my question is, do i really have to rerun the
script for every columnlist them one after another spereated by comma's
example
CREATE TABLE doc_exe ( column_a INT, column_a_un int, colC int)
GO
select * from doc_exe
GO
ALTER TABLE doc_exe DROP COLUMN column_a_un,colC
GO
select * from doc_exe
GO
drop table doc_exe
GO
http://sqlservercode.blogspot.com/|||tyty
"SQL" <denis.gobo@.gmail.com> wrote in message
news:1136924539.257435.5670@.f14g2000cwb.googlegroups.com...
> list them one after another spereated by comma's
> example
> CREATE TABLE doc_exe ( column_a INT, column_a_un int, colC int)
> GO
> select * from doc_exe
> GO
> ALTER TABLE doc_exe DROP COLUMN column_a_un,colC
> GO
> select * from doc_exe
> GO
> drop table doc_exe
> GO
> http://sqlservercode.blogspot.com/
>|||Cool. I didn't realize that this would work :)
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"SQL" <denis.gobo@.gmail.com> wrote in message
news:1136924539.257435.5670@.f14g2000cwb.googlegroups.com...
> list them one after another spereated by comma's
> example
> CREATE TABLE doc_exe ( column_a INT, column_a_un int, colC int)
> GO
> select * from doc_exe
> GO
> ALTER TABLE doc_exe DROP COLUMN column_a_un,colC
> GO
> select * from doc_exe
> GO
> drop table doc_exe
> GO
> http://sqlservercode.blogspot.com/
>|||Use drop column followed by a list of fields, seperated by commas. Dont
repeat the drop column keywords for each column.
ALTER TABLE RDKCOCUS
DROP COLUMN [Administration Executive],
[Administrator],
[Auditor],
[Chairman],....
"Abraham Andres Luna" <abe@.rdk.com> wrote in message
news:uy2OKKiFGHA.2708@.TK2MSFTNGP11.phx.gbl...
> i tried to run this script:
> ALTER TABLE RDKCOCUS
> DROP COLUMN [Administration Executive],
> DROP COLUMN [Administrator],
> DROP COLUMN [Auditor],
> DROP COLUMN [Chairman],
> DROP COLUMN [Chief Executive Officer],
> DROP COLUMN [Chief Financial Officer],
> DROP COLUMN [Chief Operating Officer],
> DROP COLUMN [Co-Chairman/Vice Chairman],
> DROP COLUMN [Controller],
> DROP COLUMN [Corporate Communications Executive],
> DROP COLUMN [Corporate Secretary],
> DROP COLUMN [Data Processing Executive],
> DROP COLUMN [Director],
> DROP COLUMN [Executive Director],
> DROP COLUMN [Executive Vice President],
> DROP COLUMN [Finance Executive],
> DROP COLUMN [General Counsel],
> DROP COLUMN [Human Resources Executive],
> DROP COLUMN [Manager],
> DROP COLUMN [Marketing Executive],
> DROP COLUMN [Officer],
> DROP COLUMN [Operations Executive],
> DROP COLUMN [Owner],
> DROP COLUMN [Partner],
> DROP COLUMN [Plant Manager],
> DROP COLUMN [President],
> DROP COLUMN [Principal],
> DROP COLUMN [Publisher],
> DROP COLUMN [Purchasing Agent],
> DROP COLUMN [Sales Executive],
> DROP COLUMN [Senior Vice President],
> DROP COLUMN [Telecommunications Executive],
> DROP COLUMN [Treasurer],
> DROP COLUMN [Vice President]
>
> and i got the error, incorrect syntax near keyword drop
> so i tried this script instead:
> ALTER TABLE RDKCOCUS
> DROP COLUMN [Administration Executive]
> and it worked. so i guess my question is, do i really have to rerun the
> script for every column
>|||I remember reading somewhere that you can drop multiple objects in 1
shot
Like this
CREATE TABLE doc_exe1 ( name INT)
GO
CREATE TABLE doc_exe2 ( name INT)
GO
DROP TABLE doc_exe1,doc_exe2
I just tried it with columns and it seems to work
Thursday, February 16, 2012
can a non-administrator user run the SQL Server Management Studio Express ?
If i install the SQL Server Express and the Management Studio in my computer with an administrator account... can a non-administrator user run the SQL Server Management Studio Express ?
When the non-administrator user tries run the SSEMS, he gets an error, something like "Cannot load the SQL Management Studio Package".
Can i set several permissions to let non-administrator users run the SSEMS ?
Hi Jamie,
Any user can run Managment Studio Express, but you need permissions to use SQL Express. By default, only members of the Administrators group have permissions to do any tasks in SQL Express. For non-administrative users, you will need to explicitely create Logins and Users in SQL Server for those users. You can only create Logins and Users when you are an SA, so you'll need to log in as an adminstrator and setup the appropriate permissions.
I'd recommend you read the Books Online topics related to security.
Mike
can a non-administrator user run the SQL Server Management Studio Express ?
If i install the SQL Server Express and the Management Studio in my computer with an administrator account... can a non-administrator user run the SQL Server Management Studio Express ?
When the non-administrator user tries run the SSEMS, he gets an error, something like "Cannot load the SQL Management Studio Package".
Can i set several permissions to let non-administrator users run the SSEMS ?
Hi Jamie,
Any user can run Managment Studio Express, but you need permissions to use SQL Express. By default, only members of the Administrators group have permissions to do any tasks in SQL Express. For non-administrative users, you will need to explicitely create Logins and Users in SQL Server for those users. You can only create Logins and Users when you are an SA, so you'll need to log in as an adminstrator and setup the appropriate permissions.
I'd recommend you read the Books Online topics related to security.
Mike