Tuesday, March 20, 2012
changing SQL syntax
I am using a java component which generates SELECT statements based on
different critieria. The SELECT statements generated are using the old SQL
syntax. For example it will generate :
SELECT e.employee_id, er.location_code
FROM employee e, employee_record er
WHERE e.employee_id = er.employee_id
What I would like is to get this SELECT statement as :
SELECT e.employee_id, er.location_code
FROM employee e INNER JOIN employee_record er ON (e.employee_id =
er.employee_id)
Now in Enterprise Manager if i create a new view and type in the old SQL
syntax, and see the result, it automatically changes it to new SQL syntax. I
would like to call that functionality from my code after I have received the
SELECT statement from the java component. Is it possible?
Thanks
Rizwan>> I would like to call that functionality from my code after I have
I guess no. It might be an internal parsing/tokenizing routine within the EM
interface & it seems unreasonable to expect some external application have
access to such internal routines.
Anith|||1) Why are you generating SQL instead of calling stored procedures?
2) Why do you care what the genrerated coee looks like anyway? They
run the same!
Monday, March 19, 2012
changing sql server account using sem ...
sql enterprise manager what is the syntax for a domain account that should be
used ( i.e. domainname/username, just username, domainname\username, etc... )
? when attempting to add an existing domain account an error message keeps
poping-up that says 'the account (local computername)/accountname is not a
valid windows account' ( for some reason it thinks its a local system account
instead of a domain account ) even though sql server is installed on the pdc.
tia ...
Hello E-Double.
I find it easiest to change the account using the services console (type
services.msc in Start>Run), that way you can browse the network and or check
the name that you enter so it will be prefixed correctly with the domain. I
just find I don't have to think about it this way.
regards,
Mark Baekdal
http://www.dbghost.com
+44 (0)208 241 1762
Database change management for SQL Server
"E-Double" wrote:
> when trying to change the sql server and sql server agent accounts using the
> sql enterprise manager what is the syntax for a domain account that should be
> used ( i.e. domainname/username, just username, domainname\username, etc... )
> ? when attempting to add an existing domain account an error message keeps
> poping-up that says 'the account (local computername)/accountname is not a
> valid windows account' ( for some reason it thinks its a local system account
> instead of a domain account ) even though sql server is installed on the pdc.
> tia ...
|||Yes, but the recommended approach is to do it through EM. This way all of
the necessary permissions and user rights assingments will be given
appropriately. However, using the services msc is an alternative as long as
you follow the KB article that describes manually setting all of the other
requirements.
http://support.microsoft.com/default...b;en-us;283811
Sincerely,
Anthony Thomas
"mark baekdal" <markbaekdal@.discussions.microsoft.com> wrote in message
news:E4E1E754-CEE0-4703-9D8E-537C0994AD47@.microsoft.com...
Hello E-Double.
I find it easiest to change the account using the services console (type
services.msc in Start>Run), that way you can browse the network and or check
the name that you enter so it will be prefixed correctly with the domain. I
just find I don't have to think about it this way.
regards,
Mark Baekdal
http://www.dbghost.com
+44 (0)208 241 1762
Database change management for SQL Server
"E-Double" wrote:
> when trying to change the sql server and sql server agent accounts using
the
> sql enterprise manager what is the syntax for a domain account that should
be
> used ( i.e. domainname/username, just username, domainname\username,
etc... )
> ? when attempting to add an existing domain account an error message
keeps
> poping-up that says 'the account (local computername)/accountname is not a
> valid windows account' ( for some reason it thinks its a local system
account
> instead of a domain account ) even though sql server is installed on the
pdc.
> tia ...
|||Thanks Anthony.
regards,
Mark Baekdal
http://www.dbghost.com
+44 (0)208 241 1762
Database change management for SQL Server
"Anthony Thomas" wrote:
> Yes, but the recommended approach is to do it through EM. This way all of
> the necessary permissions and user rights assingments will be given
> appropriately. However, using the services msc is an alternative as long as
> you follow the KB article that describes manually setting all of the other
> requirements.
> http://support.microsoft.com/default...b;en-us;283811
> Sincerely,
>
> Anthony Thomas
>
> --
> "mark baekdal" <markbaekdal@.discussions.microsoft.com> wrote in message
> news:E4E1E754-CEE0-4703-9D8E-537C0994AD47@.microsoft.com...
> Hello E-Double.
> I find it easiest to change the account using the services console (type
> services.msc in Start>Run), that way you can browse the network and or check
> the name that you enter so it will be prefixed correctly with the domain. I
> just find I don't have to think about it this way.
>
> regards,
> Mark Baekdal
> http://www.dbghost.com
> +44 (0)208 241 1762
> Database change management for SQL Server
>
>
> "E-Double" wrote:
> the
> be
> etc... )
> keeps
> account
> pdc.
>
>
changing sql server account using sem ...
sql enterprise manager what is the syntax for a domain account that should be
used ( i.e. domainname/username, just username, domainname\username, etc... )
? when attempting to add an existing domain account an error message keeps
poping-up that says 'the account (local computername)/accountname is not a
valid windows account' ( for some reason it thinks its a local system account
instead of a domain account ) even though sql server is installed on the pdc.
tia ...Hello E-Double.
I find it easiest to change the account using the services console (type
services.msc in Start>Run), that way you can browse the network and or check
the name that you enter so it will be prefixed correctly with the domain. I
just find I don't have to think about it this way.
regards,
Mark Baekdal
http://www.dbghost.com
+44 (0)208 241 1762
Database change management for SQL Server
"E-Double" wrote:
> when trying to change the sql server and sql server agent accounts using the
> sql enterprise manager what is the syntax for a domain account that should be
> used ( i.e. domainname/username, just username, domainname\username, etc... )
> ? when attempting to add an existing domain account an error message keeps
> poping-up that says 'the account (local computername)/accountname is not a
> valid windows account' ( for some reason it thinks its a local system account
> instead of a domain account ) even though sql server is installed on the pdc.
> tia ...|||Yes, but the recommended approach is to do it through EM. This way all of
the necessary permissions and user rights assingments will be given
appropriately. However, using the services msc is an alternative as long as
you follow the KB article that describes manually setting all of the other
requirements.
http://support.microsoft.com/default.aspx?scid=kb;en-us;283811
Sincerely,
Anthony Thomas
"mark baekdal" <markbaekdal@.discussions.microsoft.com> wrote in message
news:E4E1E754-CEE0-4703-9D8E-537C0994AD47@.microsoft.com...
Hello E-Double.
I find it easiest to change the account using the services console (type
services.msc in Start>Run), that way you can browse the network and or check
the name that you enter so it will be prefixed correctly with the domain. I
just find I don't have to think about it this way.
regards,
Mark Baekdal
http://www.dbghost.com
+44 (0)208 241 1762
Database change management for SQL Server
"E-Double" wrote:
> when trying to change the sql server and sql server agent accounts using
the
> sql enterprise manager what is the syntax for a domain account that should
be
> used ( i.e. domainname/username, just username, domainname\username,
etc... )
> ? when attempting to add an existing domain account an error message
keeps
> poping-up that says 'the account (local computername)/accountname is not a
> valid windows account' ( for some reason it thinks its a local system
account
> instead of a domain account ) even though sql server is installed on the
pdc.
> tia ...|||Thanks Anthony.
regards,
Mark Baekdal
http://www.dbghost.com
+44 (0)208 241 1762
Database change management for SQL Server
"Anthony Thomas" wrote:
> Yes, but the recommended approach is to do it through EM. This way all of
> the necessary permissions and user rights assingments will be given
> appropriately. However, using the services msc is an alternative as long as
> you follow the KB article that describes manually setting all of the other
> requirements.
> http://support.microsoft.com/default.aspx?scid=kb;en-us;283811
> Sincerely,
>
> Anthony Thomas
>
> --
> "mark baekdal" <markbaekdal@.discussions.microsoft.com> wrote in message
> news:E4E1E754-CEE0-4703-9D8E-537C0994AD47@.microsoft.com...
> Hello E-Double.
> I find it easiest to change the account using the services console (type
> services.msc in Start>Run), that way you can browse the network and or check
> the name that you enter so it will be prefixed correctly with the domain. I
> just find I don't have to think about it this way.
>
> regards,
> Mark Baekdal
> http://www.dbghost.com
> +44 (0)208 241 1762
> Database change management for SQL Server
>
>
> "E-Double" wrote:
> > when trying to change the sql server and sql server agent accounts using
> the
> > sql enterprise manager what is the syntax for a domain account that should
> be
> > used ( i.e. domainname/username, just username, domainname\username,
> etc... )
> > ? when attempting to add an existing domain account an error message
> keeps
> > poping-up that says 'the account (local computername)/accountname is not a
> > valid windows account' ( for some reason it thinks its a local system
> account
> > instead of a domain account ) even though sql server is installed on the
> pdc.
> > tia ...
>
>
changing sql server account using sem ...
sql enterprise manager what is the syntax for a domain account that should b
e
used ( i.e. domainname/username, just username, domainname\username, etc...
)
? when attempting to add an existing domain account an error message keeps
poping-up that says 'the account (local computername)/accountname is not a
valid windows account' ( for some reason it thinks its a local system accoun
t
instead of a domain account ) even though sql server is installed on the pdc
.
tia ...Hello E-Double.
I find it easiest to change the account using the services console (type
services.msc in Start>Run), that way you can browse the network and or check
the name that you enter so it will be prefixed correctly with the domain. I
just find I don't have to think about it this way.
regards,
Mark Baekdal
http://www.dbghost.com
+44 (0)208 241 1762
Database change management for SQL Server
"E-Double" wrote:
> when trying to change the sql server and sql server agent accounts using t
he
> sql enterprise manager what is the syntax for a domain account that should
be
> used ( i.e. domainname/username, just username, domainname\username, etc..
. )
> ? when attempting to add an existing domain account an error message keep
s
> poping-up that says 'the account (local computername)/accountname is not a
> valid windows account' ( for some reason it thinks its a local system acco
unt
> instead of a domain account ) even though sql server is installed on the p
dc.
> tia ...|||Yes, but the recommended approach is to do it through EM. This way all of
the necessary permissions and user rights assingments will be given
appropriately. However, using the services msc is an alternative as long as
you follow the KB article that describes manually setting all of the other
requirements.
http://support.microsoft.com/defaul...kb;en-us;283811
Sincerely,
Anthony Thomas
"mark baekdal" <markbaekdal@.discussions.microsoft.com> wrote in message
news:E4E1E754-CEE0-4703-9D8E-537C0994AD47@.microsoft.com...
Hello E-Double.
I find it easiest to change the account using the services console (type
services.msc in Start>Run), that way you can browse the network and or check
the name that you enter so it will be prefixed correctly with the domain. I
just find I don't have to think about it this way.
regards,
Mark Baekdal
http://www.dbghost.com
+44 (0)208 241 1762
Database change management for SQL Server
"E-Double" wrote:
> when trying to change the sql server and sql server agent accounts using
the
> sql enterprise manager what is the syntax for a domain account that should
be
> used ( i.e. domainname/username, just username, domainname\username,
etc... )
> ? when attempting to add an existing domain account an error message
keeps
> poping-up that says 'the account (local computername)/accountname is not a
> valid windows account' ( for some reason it thinks its a local system
account
> instead of a domain account ) even though sql server is installed on the
pdc.
> tia ...|||Thanks Anthony.
regards,
Mark Baekdal
http://www.dbghost.com
+44 (0)208 241 1762
Database change management for SQL Server
"Anthony Thomas" wrote:
> Yes, but the recommended approach is to do it through EM. This way all of
> the necessary permissions and user rights assingments will be given
> appropriately. However, using the services msc is an alternative as long
as
> you follow the KB article that describes manually setting all of the other
> requirements.
> http://support.microsoft.com/defaul...kb;en-us;283811
> Sincerely,
>
> Anthony Thomas
>
> --
> "mark baekdal" <markbaekdal@.discussions.microsoft.com> wrote in message
> news:E4E1E754-CEE0-4703-9D8E-537C0994AD47@.microsoft.com...
> Hello E-Double.
> I find it easiest to change the account using the services console (type
> services.msc in Start>Run), that way you can browse the network and or che
ck
> the name that you enter so it will be prefixed correctly with the domain.
I
> just find I don't have to think about it this way.
>
> regards,
> Mark Baekdal
> http://www.dbghost.com
> +44 (0)208 241 1762
> Database change management for SQL Server
>
>
> "E-Double" wrote:
>
> the
> be
> etc... )
> keeps
> account
> pdc.
>
>
Thursday, March 8, 2012
Changing Recovery Type db_option for all Databases on server
be the same on all servers.
Do you know the syntax for changing all database recovery types to "simple"?
Also, I need to change all db_options for AutoShrink to "false". I don't
want to go one by one, so I was hoping someone knows a shortcut.
Thanks,
Michelle-- undocumented, unsupported!
EXEC sp_MSForEachDB 'IF ''?'' != ''TEMPDB'' EXEC(''ALTER DATABASE [?] SET
RECOVERY SIMPLE'')'
http://www.aspfaq.com/
(Reverse address to reply.)
"JaneDoe" <JaneDoe@.discussions.microsoft.com> wrote in message
news:6B34E6BF-DF65-40C6-9623-07E3B7D0AA48@.microsoft.com...
> I have about 29 servers that I need to set all db_options for, and they
will
> be the same on all servers.
> Do you know the syntax for changing all database recovery types to
"simple"?
> Also, I need to change all db_options for AutoShrink to "false". I don't
> want to go one by one, so I was hoping someone knows a shortcut.
> Thanks,
> Michelle|||JaneDoe wrote:
> I have about 29 servers that I need to set all db_options for, and
> they will be the same on all servers.
> Do you know the syntax for changing all database recovery types to
> "simple"? Also, I need to change all db_options for AutoShrink to
> "false". I don't want to go one by one, so I was hoping someone
> knows a shortcut.
> Thanks,
> Michelle
Look at ALTER DATABASE in BOL:
SET RECOVERY SIMPLE
SET AUTO_SHRINK OFF
David Gugick
Imceda Software
www.imceda.com|||Deploy a SP on each server (perhaps in master database) that does what you
need. Then have one script that makes a remote call to each server. Also,
perhaps a WSH script that uses DMO to loop through each server, chaning
context and executing commands.
"JaneDoe" <JaneDoe@.discussions.microsoft.com> wrote in message
news:6B34E6BF-DF65-40C6-9623-07E3B7D0AA48@.microsoft.com...
> I have about 29 servers that I need to set all db_options for, and they
will
> be the same on all servers.
> Do you know the syntax for changing all database recovery types to
"simple"?
> Also, I need to change all db_options for AutoShrink to "false". I don't
> want to go one by one, so I was hoping someone knows a shortcut.
> Thanks,
> Michelle
Saturday, February 25, 2012
changing object owner syntax
We have a user name convention here that specifies users in the
following way:
jane.doe
john.smith
In order to change a database object I must specify the owner name along
with the object name. Does anyone know the proper syntax for doing this
with a user name that contains a period? When I put the user name
followed by the object name in quotes such as 'jane.doe.tb_test_table',
SQL Server can not find the object.
Any help is appreciated.
Kelly"Kelly Prendergast" <kelly.prendergast@.noaa.gov> wrote in message
news:403B9200.6882586F@.noaa.gov...
> Hi there,
> We have a user name convention here that specifies users in the
> following way:
> jane.doe
> john.smith
> In order to change a database object I must specify the owner name along
> with the object name. Does anyone know the proper syntax for doing this
> with a user name that contains a period? When I put the user name
> followed by the object name in quotes such as 'jane.doe.tb_test_table',
> SQL Server can not find the object.
> Any help is appreciated.
> Kelly
You will need to quote the owner name:
exec sp_changeobjectowner '[jane.doe].tb_test_table', 'dbo'
You may want to consider changing your naming convention - since the .
character delimits object name parts in MSSQL, it would probably be best to
avoid confusiong by not allowing it in user names. Although of course I
appreciate this may be beyond your control.
Simon