it can be found from sys.database_principals or sysusers table.
one example to build SQL by using it.
select 'sp_change_users_login ''auto_fix'','+name+',null,null' from sys.database_principals where type='S' and default_schema_name not in ('dbo','guest') and default_schema_name is not null
Quick tips or notes that probably reflects 20 percent of knowledge that usually does 80 percent of job.
Wednesday, July 27, 2011
Tuesday, July 12, 2011
import mysql dump file with double quoted identifer
not completed, seems not working....
if the file is small, just edit the dump file by adding a statement that changes session's sql mode to support double quoted identifiers.
mysql -u -p --execute "SELECT @@GLOBAL.sql_mode;"
mysql -u -p --execute "SET @@GLOBAL.sql_mode='ansi';"
mysql -u -p db
if the file is small, just edit the dump file by adding a statement that changes session's sql mode to support double quoted identifiers.
SET @@SESSION.sql_mode='ansi';if the file is large and you can't open to edit it, the sql mode can be retrieved and then be set to ansi. after the importing, the sql mode need to be set back to its original value.
mysql -u -p --execute "SELECT @@GLOBAL.sql_mode;"
mysql -u -p --execute "SET @@GLOBAL.sql_mode='ansi';"
mysql -u -p db
Subscribe to:
Posts (Atom)