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 ..
Showing posts with label guys. Show all posts
Showing posts with label guys. Show all posts
Sunday, March 25, 2012
Thursday, March 8, 2012
alter indentity field
Hi Guys,
I'm using SQL server 2000.
How do I alter column/field from type int (with Identity = Yes Not For Replication) to just normail int field. No more identity. I want it to be done using SQL script( sql query analyzer).
Please help me on this, thx
Regards,
ShaffiqHi Guys,
I'm using SQL server 2000.
How do I alter column/field from type int (with Identity = Yes Not For Replication) to just normail int field. No more identity. I want it to be done using SQL script( sql query analyzer).
Please help me on this, thx
Regards,
Shaffiq
alter table table_name
alter column column_Name int not null
that should solve your problem.|||Hi Enigma,
I'd tried it before but it not work. Even query analyzer return success message "The command(s) completed successfully." but when I open the table it still the same. And the identity field still ON
Regards,
Shaffiq|||do alteration in Enterprise Manager( dont save it) and click on 'save change script'(3 rd button from second row).copy and run that script in query analyser|||or
Alter Table MyTable ADD NewColumn int
GO
UPDATE MyTAble SET NewColumn = OldColumn
GO
ALTER TABLE MyTable DROP COLUMN MyCOlumn
GO
sp_rename 'MyTable.NewColumn','OldColumn',COLUMN
I'm using SQL server 2000.
How do I alter column/field from type int (with Identity = Yes Not For Replication) to just normail int field. No more identity. I want it to be done using SQL script( sql query analyzer).
Please help me on this, thx
Regards,
ShaffiqHi Guys,
I'm using SQL server 2000.
How do I alter column/field from type int (with Identity = Yes Not For Replication) to just normail int field. No more identity. I want it to be done using SQL script( sql query analyzer).
Please help me on this, thx
Regards,
Shaffiq
alter table table_name
alter column column_Name int not null
that should solve your problem.|||Hi Enigma,
I'd tried it before but it not work. Even query analyzer return success message "The command(s) completed successfully." but when I open the table it still the same. And the identity field still ON
Regards,
Shaffiq|||do alteration in Enterprise Manager( dont save it) and click on 'save change script'(3 rd button from second row).copy and run that script in query analyser|||or
Alter Table MyTable ADD NewColumn int
GO
UPDATE MyTAble SET NewColumn = OldColumn
GO
ALTER TABLE MyTable DROP COLUMN MyCOlumn
GO
sp_rename 'MyTable.NewColumn','OldColumn',COLUMN
Saturday, February 25, 2012
Alter column
Hello guys,
I already have a table, and i want to add a new column by using a script -
how do i do it?
I need it to be the identity column and it should be the first column!!
I can do it using enterprise manager- insert column at the first row, but i
just cant find a TSQL Script to do it
thanks in advance
Reagrds
IshanYou can use
alter table mytable add newfield int identity
But I do not think there is a way to make it the first column using only one
command. As far as I remember Enterprise Manager do several steps in the
background including creating a new table with the new field and moving data
from the original table.
Ben Nevarez, MCDBA, OCP
Database Administrator
"Ishan Bhalla" wrote:
> Hello guys,
> I already have a table, and i want to add a new column by using a script -
> how do i do it?
> I need it to be the identity column and it should be the first column!!
> I can do it using enterprise manager- insert column at the first row, but
i
> just cant find a TSQL Script to do it
> thanks in advance
> Reagrds
> Ishan|||Ishan
Actually , it does not matter the order , does it? You can run SELECT as
SELECT IdentityColumn,col1,col2,col2......
Or
SELECT col1,col2,col2...... ,IdentityColumn FROM Table
"Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
news:2B5884A1-7E99-45D5-90A6-61F8198A664B@.microsoft.com...
> Hello guys,
> I already have a table, and i want to add a new column by using a script -
> how do i do it?
> I need it to be the identity column and it should be the first column!!
> I can do it using enterprise manager- insert column at the first row, but
> i
> just cant find a TSQL Script to do it
> thanks in advance
> Reagrds
> Ishan|||Hi,
actually i agree that i should not make a difference IF the queries dont
have something like Select * from xyz and then in the VB code the fields are
being accesssed by the ordinal position rather than the field name. As i don
t
know that i just want to be sure!!
Thanks anyway!!!
regards
Ishan
"Uri Dimant" wrote:
> Ishan
> Actually , it does not matter the order , does it? You can run SELECT as
> SELECT IdentityColumn,col1,col2,col2......
> Or
> SELECT col1,col2,col2...... ,IdentityColumn FROM Table
>
>
> "Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
> news:2B5884A1-7E99-45D5-90A6-61F8198A664B@.microsoft.com...
>
>|||Ishan Bhalla wrote:
> Hi,
> actually i agree that i should not make a difference IF the queries dont
> have something like Select * from xyz and then in the VB code the fields a
re
> being accesssed by the ordinal position rather than the field name. As i d
ont
> know that i just want to be sure!!
>
Perfect reason why SELECT * shouldn't be used in production code!!!
Another thread was asking for specific reasons why not to use SELECT *,
you just provided a great one.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||hi
i agree and i have never done something like it, but this is a code
maintainance, and i dont know what has been written in the applications!!!
the apps seem to have been poorly written
regards
Ishan
"Tracy McKibben" wrote:
> Ishan Bhalla wrote:
> Perfect reason why SELECT * shouldn't be used in production code!!!
> Another thread was asking for specific reasons why not to use SELECT *,
> you just provided a great one.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||"Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
news:3B1674B9-A45A-4260-9502-47A2CB223283@.microsoft.com...
> hi
> i agree and i have never done something like it, but this is a code
> maintainance, and i dont know what has been written in the applications!!!
> the apps seem to have been poorly written
Generally though in this case, the worst thing you can do is put the column
FIRST since all queries will break.
If you make it "last" then in theory most queries will probably still work
since they'll just pick off N-1 columns.
[vbcol=seagreen]
> regards
> Ishan
> "Tracy McKibben" wrote:
>
dont[vbcol=seagreen]
fields are[vbcol=seagreen]
i dont[vbcol=seagreen]|||Actually these are stagin tables and a new one is created everyday. The VB
code just loops through the code and access the columns by ordinal position!
!!
thanks everyone for your point of view!
regards
Ishan
"Greg D. Moore (Strider)" wrote:
> "Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
> news:3B1674B9-A45A-4260-9502-47A2CB223283@.microsoft.com...
> Generally though in this case, the worst thing you can do is put the colum
n
> FIRST since all queries will break.
> If you make it "last" then in theory most queries will probably still work
> since they'll just pick off N-1 columns.
>
> dont
> fields are
> i dont
>
>
I already have a table, and i want to add a new column by using a script -
how do i do it?
I need it to be the identity column and it should be the first column!!
I can do it using enterprise manager- insert column at the first row, but i
just cant find a TSQL Script to do it
thanks in advance
Reagrds
IshanYou can use
alter table mytable add newfield int identity
But I do not think there is a way to make it the first column using only one
command. As far as I remember Enterprise Manager do several steps in the
background including creating a new table with the new field and moving data
from the original table.
Ben Nevarez, MCDBA, OCP
Database Administrator
"Ishan Bhalla" wrote:
> Hello guys,
> I already have a table, and i want to add a new column by using a script -
> how do i do it?
> I need it to be the identity column and it should be the first column!!
> I can do it using enterprise manager- insert column at the first row, but
i
> just cant find a TSQL Script to do it
> thanks in advance
> Reagrds
> Ishan|||Ishan
Actually , it does not matter the order , does it? You can run SELECT as
SELECT IdentityColumn,col1,col2,col2......
Or
SELECT col1,col2,col2...... ,IdentityColumn FROM Table
"Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
news:2B5884A1-7E99-45D5-90A6-61F8198A664B@.microsoft.com...
> Hello guys,
> I already have a table, and i want to add a new column by using a script -
> how do i do it?
> I need it to be the identity column and it should be the first column!!
> I can do it using enterprise manager- insert column at the first row, but
> i
> just cant find a TSQL Script to do it
> thanks in advance
> Reagrds
> Ishan|||Hi,
actually i agree that i should not make a difference IF the queries dont
have something like Select * from xyz and then in the VB code the fields are
being accesssed by the ordinal position rather than the field name. As i don
t
know that i just want to be sure!!
Thanks anyway!!!
regards
Ishan
"Uri Dimant" wrote:
> Ishan
> Actually , it does not matter the order , does it? You can run SELECT as
> SELECT IdentityColumn,col1,col2,col2......
> Or
> SELECT col1,col2,col2...... ,IdentityColumn FROM Table
>
>
> "Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
> news:2B5884A1-7E99-45D5-90A6-61F8198A664B@.microsoft.com...
>
>|||Ishan Bhalla wrote:
> Hi,
> actually i agree that i should not make a difference IF the queries dont
> have something like Select * from xyz and then in the VB code the fields a
re
> being accesssed by the ordinal position rather than the field name. As i d
ont
> know that i just want to be sure!!
>
Perfect reason why SELECT * shouldn't be used in production code!!!
Another thread was asking for specific reasons why not to use SELECT *,
you just provided a great one.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||hi
i agree and i have never done something like it, but this is a code
maintainance, and i dont know what has been written in the applications!!!
the apps seem to have been poorly written
regards
Ishan
"Tracy McKibben" wrote:
> Ishan Bhalla wrote:
> Perfect reason why SELECT * shouldn't be used in production code!!!
> Another thread was asking for specific reasons why not to use SELECT *,
> you just provided a great one.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||"Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
news:3B1674B9-A45A-4260-9502-47A2CB223283@.microsoft.com...
> hi
> i agree and i have never done something like it, but this is a code
> maintainance, and i dont know what has been written in the applications!!!
> the apps seem to have been poorly written
Generally though in this case, the worst thing you can do is put the column
FIRST since all queries will break.
If you make it "last" then in theory most queries will probably still work
since they'll just pick off N-1 columns.
[vbcol=seagreen]
> regards
> Ishan
> "Tracy McKibben" wrote:
>
dont[vbcol=seagreen]
fields are[vbcol=seagreen]
i dont[vbcol=seagreen]|||Actually these are stagin tables and a new one is created everyday. The VB
code just loops through the code and access the columns by ordinal position!
!!
thanks everyone for your point of view!
regards
Ishan
"Greg D. Moore (Strider)" wrote:
> "Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
> news:3B1674B9-A45A-4260-9502-47A2CB223283@.microsoft.com...
> Generally though in this case, the worst thing you can do is put the colum
n
> FIRST since all queries will break.
> If you make it "last" then in theory most queries will probably still work
> since they'll just pick off N-1 columns.
>
> dont
> fields are
> i dont
>
>
Alter column
Hello guys,
I already have a table, and i want to add a new column by using a script -
how do i do it?
I need it to be the identity column and it should be the first column!!
I can do it using enterprise manager- insert column at the first row, but i
just cant find a TSQL Script to do it
thanks in advance
Reagrds
IshanYou can use
alter table mytable add newfield int identity
But I do not think there is a way to make it the first column using only one
command. As far as I remember Enterprise Manager do several steps in the
background including creating a new table with the new field and moving data
from the original table.
Ben Nevarez, MCDBA, OCP
Database Administrator
"Ishan Bhalla" wrote:
> Hello guys,
> I already have a table, and i want to add a new column by using a script -
> how do i do it?
> I need it to be the identity column and it should be the first column!!
> I can do it using enterprise manager- insert column at the first row, but i
> just cant find a TSQL Script to do it
> thanks in advance
> Reagrds
> Ishan|||Ishan
Actually , it does not matter the order , does it? You can run SELECT as
SELECT IdentityColumn,col1,col2,col2......
Or
SELECT col1,col2,col2...... ,IdentityColumn FROM Table
"Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
news:2B5884A1-7E99-45D5-90A6-61F8198A664B@.microsoft.com...
> Hello guys,
> I already have a table, and i want to add a new column by using a script -
> how do i do it?
> I need it to be the identity column and it should be the first column!!
> I can do it using enterprise manager- insert column at the first row, but
> i
> just cant find a TSQL Script to do it
> thanks in advance
> Reagrds
> Ishan|||Hi,
actually i agree that i should not make a difference IF the queries dont
have something like Select * from xyz and then in the VB code the fields are
being accesssed by the ordinal position rather than the field name. As i dont
know that i just want to be sure!!
Thanks anyway!!!
regards
Ishan
"Uri Dimant" wrote:
> Ishan
> Actually , it does not matter the order , does it? You can run SELECT as
> SELECT IdentityColumn,col1,col2,col2......
> Or
> SELECT col1,col2,col2...... ,IdentityColumn FROM Table
>
>
> "Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
> news:2B5884A1-7E99-45D5-90A6-61F8198A664B@.microsoft.com...
> > Hello guys,
> >
> > I already have a table, and i want to add a new column by using a script -
> > how do i do it?
> > I need it to be the identity column and it should be the first column!!
> >
> > I can do it using enterprise manager- insert column at the first row, but
> > i
> > just cant find a TSQL Script to do it
> >
> > thanks in advance
> > Reagrds
> > Ishan
>
>|||Ishan Bhalla wrote:
> Hi,
> actually i agree that i should not make a difference IF the queries dont
> have something like Select * from xyz and then in the VB code the fields are
> being accesssed by the ordinal position rather than the field name. As i dont
> know that i just want to be sure!!
>
Perfect reason why SELECT * shouldn't be used in production code!!!
Another thread was asking for specific reasons why not to use SELECT *,
you just provided a great one.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||hi
i agree and i have never done something like it, but this is a code
maintainance, and i dont know what has been written in the applications!!!
the apps seem to have been poorly written
regards
Ishan
"Tracy McKibben" wrote:
> Ishan Bhalla wrote:
> > Hi,
> >
> > actually i agree that i should not make a difference IF the queries dont
> > have something like Select * from xyz and then in the VB code the fields are
> > being accesssed by the ordinal position rather than the field name. As i dont
> > know that i just want to be sure!!
> >
> Perfect reason why SELECT * shouldn't be used in production code!!!
> Another thread was asking for specific reasons why not to use SELECT *,
> you just provided a great one.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||"Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
news:3B1674B9-A45A-4260-9502-47A2CB223283@.microsoft.com...
> hi
> i agree and i have never done something like it, but this is a code
> maintainance, and i dont know what has been written in the applications!!!
> the apps seem to have been poorly written
Generally though in this case, the worst thing you can do is put the column
FIRST since all queries will break.
If you make it "last" then in theory most queries will probably still work
since they'll just pick off N-1 columns.
> regards
> Ishan
> "Tracy McKibben" wrote:
> > Ishan Bhalla wrote:
> > > Hi,
> > >
> > > actually i agree that i should not make a difference IF the queries
dont
> > > have something like Select * from xyz and then in the VB code the
fields are
> > > being accesssed by the ordinal position rather than the field name. As
i dont
> > > know that i just want to be sure!!
> > >
> >
> > Perfect reason why SELECT * shouldn't be used in production code!!!
> > Another thread was asking for specific reasons why not to use SELECT *,
> > you just provided a great one.
> >
> >
> > --
> > Tracy McKibben
> > MCDBA
> > http://www.realsqlguy.com
> >|||Actually these are stagin tables and a new one is created everyday. The VB
code just loops through the code and access the columns by ordinal position!!!
thanks everyone for your point of view!
regards
Ishan
"Greg D. Moore (Strider)" wrote:
> "Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
> news:3B1674B9-A45A-4260-9502-47A2CB223283@.microsoft.com...
> > hi
> >
> > i agree and i have never done something like it, but this is a code
> > maintainance, and i dont know what has been written in the applications!!!
> > the apps seem to have been poorly written
> Generally though in this case, the worst thing you can do is put the column
> FIRST since all queries will break.
> If you make it "last" then in theory most queries will probably still work
> since they'll just pick off N-1 columns.
>
> >
> > regards
> > Ishan
> >
> > "Tracy McKibben" wrote:
> >
> > > Ishan Bhalla wrote:
> > > > Hi,
> > > >
> > > > actually i agree that i should not make a difference IF the queries
> dont
> > > > have something like Select * from xyz and then in the VB code the
> fields are
> > > > being accesssed by the ordinal position rather than the field name. As
> i dont
> > > > know that i just want to be sure!!
> > > >
> > >
> > > Perfect reason why SELECT * shouldn't be used in production code!!!
> > > Another thread was asking for specific reasons why not to use SELECT *,
> > > you just provided a great one.
> > >
> > >
> > > --
> > > Tracy McKibben
> > > MCDBA
> > > http://www.realsqlguy.com
> > >
>
>
I already have a table, and i want to add a new column by using a script -
how do i do it?
I need it to be the identity column and it should be the first column!!
I can do it using enterprise manager- insert column at the first row, but i
just cant find a TSQL Script to do it
thanks in advance
Reagrds
IshanYou can use
alter table mytable add newfield int identity
But I do not think there is a way to make it the first column using only one
command. As far as I remember Enterprise Manager do several steps in the
background including creating a new table with the new field and moving data
from the original table.
Ben Nevarez, MCDBA, OCP
Database Administrator
"Ishan Bhalla" wrote:
> Hello guys,
> I already have a table, and i want to add a new column by using a script -
> how do i do it?
> I need it to be the identity column and it should be the first column!!
> I can do it using enterprise manager- insert column at the first row, but i
> just cant find a TSQL Script to do it
> thanks in advance
> Reagrds
> Ishan|||Ishan
Actually , it does not matter the order , does it? You can run SELECT as
SELECT IdentityColumn,col1,col2,col2......
Or
SELECT col1,col2,col2...... ,IdentityColumn FROM Table
"Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
news:2B5884A1-7E99-45D5-90A6-61F8198A664B@.microsoft.com...
> Hello guys,
> I already have a table, and i want to add a new column by using a script -
> how do i do it?
> I need it to be the identity column and it should be the first column!!
> I can do it using enterprise manager- insert column at the first row, but
> i
> just cant find a TSQL Script to do it
> thanks in advance
> Reagrds
> Ishan|||Hi,
actually i agree that i should not make a difference IF the queries dont
have something like Select * from xyz and then in the VB code the fields are
being accesssed by the ordinal position rather than the field name. As i dont
know that i just want to be sure!!
Thanks anyway!!!
regards
Ishan
"Uri Dimant" wrote:
> Ishan
> Actually , it does not matter the order , does it? You can run SELECT as
> SELECT IdentityColumn,col1,col2,col2......
> Or
> SELECT col1,col2,col2...... ,IdentityColumn FROM Table
>
>
> "Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
> news:2B5884A1-7E99-45D5-90A6-61F8198A664B@.microsoft.com...
> > Hello guys,
> >
> > I already have a table, and i want to add a new column by using a script -
> > how do i do it?
> > I need it to be the identity column and it should be the first column!!
> >
> > I can do it using enterprise manager- insert column at the first row, but
> > i
> > just cant find a TSQL Script to do it
> >
> > thanks in advance
> > Reagrds
> > Ishan
>
>|||Ishan Bhalla wrote:
> Hi,
> actually i agree that i should not make a difference IF the queries dont
> have something like Select * from xyz and then in the VB code the fields are
> being accesssed by the ordinal position rather than the field name. As i dont
> know that i just want to be sure!!
>
Perfect reason why SELECT * shouldn't be used in production code!!!
Another thread was asking for specific reasons why not to use SELECT *,
you just provided a great one.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||hi
i agree and i have never done something like it, but this is a code
maintainance, and i dont know what has been written in the applications!!!
the apps seem to have been poorly written
regards
Ishan
"Tracy McKibben" wrote:
> Ishan Bhalla wrote:
> > Hi,
> >
> > actually i agree that i should not make a difference IF the queries dont
> > have something like Select * from xyz and then in the VB code the fields are
> > being accesssed by the ordinal position rather than the field name. As i dont
> > know that i just want to be sure!!
> >
> Perfect reason why SELECT * shouldn't be used in production code!!!
> Another thread was asking for specific reasons why not to use SELECT *,
> you just provided a great one.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||"Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
news:3B1674B9-A45A-4260-9502-47A2CB223283@.microsoft.com...
> hi
> i agree and i have never done something like it, but this is a code
> maintainance, and i dont know what has been written in the applications!!!
> the apps seem to have been poorly written
Generally though in this case, the worst thing you can do is put the column
FIRST since all queries will break.
If you make it "last" then in theory most queries will probably still work
since they'll just pick off N-1 columns.
> regards
> Ishan
> "Tracy McKibben" wrote:
> > Ishan Bhalla wrote:
> > > Hi,
> > >
> > > actually i agree that i should not make a difference IF the queries
dont
> > > have something like Select * from xyz and then in the VB code the
fields are
> > > being accesssed by the ordinal position rather than the field name. As
i dont
> > > know that i just want to be sure!!
> > >
> >
> > Perfect reason why SELECT * shouldn't be used in production code!!!
> > Another thread was asking for specific reasons why not to use SELECT *,
> > you just provided a great one.
> >
> >
> > --
> > Tracy McKibben
> > MCDBA
> > http://www.realsqlguy.com
> >|||Actually these are stagin tables and a new one is created everyday. The VB
code just loops through the code and access the columns by ordinal position!!!
thanks everyone for your point of view!
regards
Ishan
"Greg D. Moore (Strider)" wrote:
> "Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
> news:3B1674B9-A45A-4260-9502-47A2CB223283@.microsoft.com...
> > hi
> >
> > i agree and i have never done something like it, but this is a code
> > maintainance, and i dont know what has been written in the applications!!!
> > the apps seem to have been poorly written
> Generally though in this case, the worst thing you can do is put the column
> FIRST since all queries will break.
> If you make it "last" then in theory most queries will probably still work
> since they'll just pick off N-1 columns.
>
> >
> > regards
> > Ishan
> >
> > "Tracy McKibben" wrote:
> >
> > > Ishan Bhalla wrote:
> > > > Hi,
> > > >
> > > > actually i agree that i should not make a difference IF the queries
> dont
> > > > have something like Select * from xyz and then in the VB code the
> fields are
> > > > being accesssed by the ordinal position rather than the field name. As
> i dont
> > > > know that i just want to be sure!!
> > > >
> > >
> > > Perfect reason why SELECT * shouldn't be used in production code!!!
> > > Another thread was asking for specific reasons why not to use SELECT *,
> > > you just provided a great one.
> > >
> > >
> > > --
> > > Tracy McKibben
> > > MCDBA
> > > http://www.realsqlguy.com
> > >
>
>
Sunday, February 19, 2012
Allowing SQL Users to change password
Hi guys,
Is there anyway to allow SQL Server users to change their own passwords without giving them rights to "db_securityadmin" ?
Our M$ adviser suggested creating our own app using SQL NS and DMO to do it.
Is there any easier method, reference, download sample from the web?from qa:
sp_password 'oldpassword', 'newpassword'|||Without giving them sysadmin or securityadmin , is it possible?
I mean ..just changing their own password...
I wrote this:
EXEC sp_password '123', '456', 'test1'
I got this error:
"Only members of the sysadmin role can use the loginame option. The password was not changed."
But I read this in Books Online, can't really understand it yet...:
Permissions
Execute permissions default to the public role for a user changing the password for his or her own login. Members of the securityadmin and sysadmin fixed server roles can change the password for another user's login.|||woppps...of course...just exclude the loginname...sorry bout that...
okay ..thanks..it works!
EXEC sp_password '123', '456'
Is there anyway to allow SQL Server users to change their own passwords without giving them rights to "db_securityadmin" ?
Our M$ adviser suggested creating our own app using SQL NS and DMO to do it.
Is there any easier method, reference, download sample from the web?from qa:
sp_password 'oldpassword', 'newpassword'|||Without giving them sysadmin or securityadmin , is it possible?
I mean ..just changing their own password...
I wrote this:
EXEC sp_password '123', '456', 'test1'
I got this error:
"Only members of the sysadmin role can use the loginame option. The password was not changed."
But I read this in Books Online, can't really understand it yet...:
Permissions
Execute permissions default to the public role for a user changing the password for his or her own login. Members of the securityadmin and sysadmin fixed server roles can change the password for another user's login.|||woppps...of course...just exclude the loginname...sorry bout that...
okay ..thanks..it works!
EXEC sp_password '123', '456'
Sunday, February 12, 2012
all spaces in a CHAR(5) column
i'm going nuts with this, i suppose i will crack it eventually, but i thought i'd ask around here, seems like all the smart SQL Server guys hang out here
(i'm an SQL guy, not an SQL Server guy)
how does one place 5 spaces into a CHAR(5) column?
create table testzeros
( id smallint not null primary key identity
, myfield char(5)
)
insert into testzeros (myfield) values (' 1')
insert into testzeros (myfield) values (' 11')
insert into testzeros (myfield) values (' 111')
insert into testzeros (myfield) values (' 1111')
insert into testzeros (myfield) values ('11111')
insert into testzeros (myfield) values (' ')
select id
, myfield
, len(myfield) as L
from testzerosno matter what i do, id=6 shows up with L=0, just like an empty string
i've even tried inserting 4 spaces and a non-blank character, which enters just fine, just as you would expect, but when i update the value and replace the non-blank character with a blank, all 5 spaces collapse back to an empty string
is there some kind of server setting like SET ALL_SPACE_EQUALS_EMPTY_YOU_IDIOT to OFF or something?FROM BOL:
"Interpretation of an empty string is controlled by the compatibility level, which is set with the sp_dbcmptlevel system stored procedure. If the compatibility level is 65 or lower, SQL Server interprets empty strings as single spaces. If the compatibility level is 70 or 80, SQL Server interprets empty strings as empty strings. For more information, see sp_dbcmptlevel."
I never used this and afterreading the documentation for sp_dbcmptlevel I am not sure it is such a good idea.|||thanks, that at least sounds somewhat related
but we aren't talking about inserting an empty string
i even tried this --
insert into testzeros(myfield) values (space(5))
and this was converted to empty string as well|||aha!! found it!!
i had declared it as NULL
BOL says:If ANSI_PADDING is ON when a char NULL column is created, it behaves the same as a char NOT NULL column: values are right-padded to the size of the column. If ANSI_PADDING is OFF when a char NULL column is created, it behaves like a varchar column with ANSI_PADDING set OFF: trailing blanks are truncated.
i am an idiot
:)|||Idiocy has been copyrighted??|||Idiots don't find the solutions to their own problems. Only an idiot would not know this.
Where that leaves you, I'm not sure. But thanks for posting the solution anyway.|||Idiocy has been copyrighted??no, but that particular phrase is all mine -- and it's a trademark!!
i lied about it being registered, though, and i suppose somebody else will eventually run out and register it -- i guess i'm just an idiot!!|||I did'nt know this off the top of my head. So I must be pretty stupid.
I am not participating in this forum anymore. Logging out.|||Try such. Its perversion IMHO, but one works
create table testzeros
( id smallint not null primary key identity
, myfield varchar(5) <--
)
insert into testzeros (myfield) values (' 1')
insert into testzeros (myfield) values (' 11')
insert into testzeros (myfield) values (' 111')
insert into testzeros (myfield) values (' 1111')
insert into testzeros (myfield) values ('11111')
insert into testzeros (myfield) values (' ')
select id
, myfield
, len(myfield) as L
, len(replace(myfield, ' ', '_')) <-- look this result
from testzeros|||no, but that particular phrase is all mine -- and it's a trademark!!
Ahh. That may explain why we have to go around saying "I R dum".|||"I R Dum" is freely available as SharePhrase. You can use it all you want, but you are not allowed to modify it or sell it.|||I'm thinking that with the mountains of easily verifiable "prior art" on this topic, that it would never survive a trademark registration. I could be wrong, but I think this would be a real pig to try to register. ;)
-PatP|||... the mountains of easily verifiable "prior art" on this topic... tee hee
i'm responsible for creating plenty of piles, that's for sure ;)
(i'm an SQL guy, not an SQL Server guy)
how does one place 5 spaces into a CHAR(5) column?
create table testzeros
( id smallint not null primary key identity
, myfield char(5)
)
insert into testzeros (myfield) values (' 1')
insert into testzeros (myfield) values (' 11')
insert into testzeros (myfield) values (' 111')
insert into testzeros (myfield) values (' 1111')
insert into testzeros (myfield) values ('11111')
insert into testzeros (myfield) values (' ')
select id
, myfield
, len(myfield) as L
from testzerosno matter what i do, id=6 shows up with L=0, just like an empty string
i've even tried inserting 4 spaces and a non-blank character, which enters just fine, just as you would expect, but when i update the value and replace the non-blank character with a blank, all 5 spaces collapse back to an empty string
is there some kind of server setting like SET ALL_SPACE_EQUALS_EMPTY_YOU_IDIOT to OFF or something?FROM BOL:
"Interpretation of an empty string is controlled by the compatibility level, which is set with the sp_dbcmptlevel system stored procedure. If the compatibility level is 65 or lower, SQL Server interprets empty strings as single spaces. If the compatibility level is 70 or 80, SQL Server interprets empty strings as empty strings. For more information, see sp_dbcmptlevel."
I never used this and afterreading the documentation for sp_dbcmptlevel I am not sure it is such a good idea.|||thanks, that at least sounds somewhat related
but we aren't talking about inserting an empty string
i even tried this --
insert into testzeros(myfield) values (space(5))
and this was converted to empty string as well|||aha!! found it!!
i had declared it as NULL
BOL says:If ANSI_PADDING is ON when a char NULL column is created, it behaves the same as a char NOT NULL column: values are right-padded to the size of the column. If ANSI_PADDING is OFF when a char NULL column is created, it behaves like a varchar column with ANSI_PADDING set OFF: trailing blanks are truncated.
i am an idiot
:)|||Idiocy has been copyrighted??|||Idiots don't find the solutions to their own problems. Only an idiot would not know this.
Where that leaves you, I'm not sure. But thanks for posting the solution anyway.|||Idiocy has been copyrighted??no, but that particular phrase is all mine -- and it's a trademark!!
i lied about it being registered, though, and i suppose somebody else will eventually run out and register it -- i guess i'm just an idiot!!|||I did'nt know this off the top of my head. So I must be pretty stupid.
I am not participating in this forum anymore. Logging out.|||Try such. Its perversion IMHO, but one works
create table testzeros
( id smallint not null primary key identity
, myfield varchar(5) <--
)
insert into testzeros (myfield) values (' 1')
insert into testzeros (myfield) values (' 11')
insert into testzeros (myfield) values (' 111')
insert into testzeros (myfield) values (' 1111')
insert into testzeros (myfield) values ('11111')
insert into testzeros (myfield) values (' ')
select id
, myfield
, len(myfield) as L
, len(replace(myfield, ' ', '_')) <-- look this result
from testzeros|||no, but that particular phrase is all mine -- and it's a trademark!!
Ahh. That may explain why we have to go around saying "I R dum".|||"I R Dum" is freely available as SharePhrase. You can use it all you want, but you are not allowed to modify it or sell it.|||I'm thinking that with the mountains of easily verifiable "prior art" on this topic, that it would never survive a trademark registration. I could be wrong, but I think this would be a real pig to try to register. ;)
-PatP|||... the mountains of easily verifiable "prior art" on this topic... tee hee
i'm responsible for creating plenty of piles, that's for sure ;)
All rows in a Sigle page
Hi guys,
I have requirement to show all the data from a table in a single page
or minimum 100 rows in the first page . How it is possible. Please any
body can solve my query.
Thanks in advance.
ShrinivasYou can go to report properties and adjust the page height in layout
tab.
Shrinivas wrote:
> Hi guys,
>
> I have requirement to show all the data from a table in a single page
> or minimum 100 rows in the first page . How it is possible. Please any
> body can solve my query.
> Thanks in advance.
> Shrinivas
I have requirement to show all the data from a table in a single page
or minimum 100 rows in the first page . How it is possible. Please any
body can solve my query.
Thanks in advance.
ShrinivasYou can go to report properties and adjust the page height in layout
tab.
Shrinivas wrote:
> Hi guys,
>
> I have requirement to show all the data from a table in a single page
> or minimum 100 rows in the first page . How it is possible. Please any
> body can solve my query.
> Thanks in advance.
> Shrinivas
Subscribe to:
Posts (Atom)