Posts Tagged ‘Sql’
SQL文 ジョインして更新
update schedule set [full_name] = user_info_table.last_name + ' ' + user_info_table.first_name , [organization_name] = organization.organization_name FROM [dbo].[schedule] LEFT JOIN user_info_table ON user_info_table.user_info_table_id = schedule.user_info_table_id left join user_info_table_organization on user_info_table_organization.user_info_table_id = user_info_table.user_info_table_id and user_info_table_organization.default_flg = 1 left join organization on organization.organization_id = user_info_table_organization.organization_id WHERE full_name is null AND user_info_table.user_info_table_id is not NULL
SQL Serverで、データベースに残ったユーザを消す
データベースをSQL Server 2000 から Sql Server 2008 に移行した時、
2000のデータベースをでタッチして、2008のデータベースにアッタッチしたのですが
データベース内にユーザが残ってしまいました。
その昔は、そのままいったんデータベースユーザを削除して、再度追加していたのですが、
SqlServer 2008のManagement Studio では消せないようです。
そういう場合、下記のコマンドで消せました。
ユーザをスキーマに割り当ててからユーザとスキーマを削除する
ALTER USER ユーザ名 WITH DEFAULT_SCHEMA = ユーザ名
DROP SCHEMA ユーザ名
DROP USER ユーザ名
GO
他にも方法があったような・・・・・・・・