Pawel's profileOut of Space - Pawel Pot...PhotosBlogListsMore ![]() | Help |
|
April 27 Steve Ballmer at MSSDD2007Yesterday I went to Gromada Hotel to see Steve Ballmer's (CEO of Microsoft Corp.) speech (special meeting with MVP community). Steve was asked about MSN (comparing to Google), opening devs center in Poland, and Vista improvements. He is indeed a great speaker. Of course we know him as very impulsive person, but this time his performance was slightly different. I was about to ask him about SQL Server 2005 SP3, but there was no time for more questions :-) Anyway, this is deffinitely a good news that VIPs from Microsoft remember and care about Polish communities. Some is_srvrolemember replacementIf you have tried to use is_srvrolemember system function (which allows to check if login is a member of chosen fixed server role) then you know there are some problems with it. If you have a Windows login which is not trusted explicitly in SQL Server then is_srvrolemember returns NULL no matter which fixed role will be entered as function parameter. Couple days ago I started to think about writing my own is_srvrolemember implementation. The main problem is that the system stored procedure xp_logininfo can't be executed explicitly inside the function code. So, finally I've decided to write a stored procedure. The procedure is shown below. It takes two input parameters (fixed server role name and the name of login of any type - Windows or SQL Server), checks if a given login is in a given role and returns: 0 - if login is not a member of role, 1 - if login is a member of role, 2 - if login or role does not exist or if SQL Server can't get information about Windows login from DC. USE master GO IF OBJECT_ID(N'dbo.sp_logininfo') IS NOT NULL DROP PROCEDURE dbo.sp_logininfo GO CREATE PROCEDURE dbo.sp_logininfo ( @role SYSNAME, @login SYSNAME ) AS SET NOCOUNT ON DECLARE @result TINYINT DECLARE @login_info TABLE ( account_name SYSNAME NULL, [type] CHAR(8) NULL, privilege CHAR(9) NULL, mapped_login_name SYSNAME NULL, permission_path SYSNAME NULL ) SET @result = 0 BEGIN TRY INSERT @login_info EXEC xp_logininfo @login, 'all' END TRY BEGIN CATCH SET @result = 2 END CATCH IF ( SELECT COUNT(*) FROM @login_info ) = 0 OR NOT EXISTS ( SELECT 1 FROM sys.server_principals WHERE name = @role ) SET @result = 2 IF ( SELECT COUNT(*) FROM ( SELECT p.permission_path, r.name FROM @login_info p INNER JOIN sys.server_principals pr ON p.permission_path = pr.name INNER JOIN sys.server_role_members rm ON pr.principal_id = rm.member_principal_id INNER JOIN sys.server_principals r ON rm.role_principal_id = r.principal_id WHERE p.account_name = @login AND r.name = @role UNION SELECT p.name, r.name FROM sys.server_principals p INNER JOIN sys.server_role_members rm ON p.principal_id = rm.member_principal_id INNER JOIN sys.server_principals r ON rm.role_principal_id = r.principal_id WHERE p.name = @login AND r.name = @role ) AS T ) > 0 SET @result = 1 RETURN @result GO -- Test ---------------------------------------------- DECLARE @Res TINYINT EXEC @Res = dbo.sp_logininfo 'sysadmin', 'AAA\bbb' SELECT @Res AS [Is AAA\bbb a mamber of sysadmin role?] DECLARE @Res1 TINYINT EXEC @Res1 = dbo.sp_logininfo 'sysadmin', 'sa' SELECT @Res1 AS [Is sa a mamber sysadmin role?] April 26 New article on TechNetThere is a new article on TechNet Poland website. It was written by Marek Adamczuk and me. The article is about logon triggers - new functionality provided by SQL Server 2005 Service Pack 2. Link to the article: http://www.microsoft.com/poland/technet/article/art0060_01.mspx. MSSDD2007 PartyYesterday there was a party of Microsoft communities (this party was a part of Microsoft Security Summit & Developer Days 2007 event). The party was fine - lots of beer, lots of people, lots of fun. As always, I met some new people and spoke to some old friends. However, where were the angels from last year WSS community party? ;-) April 24 Windows Live Writer Beta testThis is a test post written with Windows Live Writer (Beta). Download Windows Live Writer from http://windowslivewriter.spaces.live.com/. April 20 Build of the day: 3161Another cumulative hotfix for SQL Server 2005 SP2 has been developed. You can find some information on it here - http://support.microsoft.com/default.aspx/kb/935356. However, there is no download right now. It is written that this package needs some additional testing. Should we wait for SP3??? April 17 My first look at Red Gate SQL RefactorYesterday I installed Red Gate SQL Refactor - the add-in for SQL Server Management Studio which allows to refactor T-SQL code in many ways. I tried almost every feature and it works pretty nice. However with large code it can hang for couple of minutes. Anyway, my favourite features are Uppercase Keywords and Lay Out Code :-)
You can download SQL Refactor from www.red-gate.com. April 15 Make your assemblies visible and usable in Script TaskHave you ever tried to reference your own assembly in Script Task or Script Component in SQL Server Integration Services project? If you have then I think you have noticed that adding the assembly to GAC is just not enough. The referenced assembly (the DLL file) must be copied to %windir%\Microsoft.NET\Framework\v2.0.xxxx folder or to %ProgramFiles%\Microsoft SQL Server\90\SDK\Assemblies folder (then it becomes visible in References), and then you must add it to GAC (otherwise it will be visible in References but it will also generate runtime error). Only the assemblies located in these two folders are visible in the Add Reference window. This fact was recorded in BOL (however, it is not said that the assembly must be added to GAC) - http://msdn2.microsoft.com/en-us/library/ms136007.aspx.
Credits to Marek Adamczuk for his helpful ideas. Apex SQL Studio free for MCTsSometimes it's worth to visit MCT Home website. Last week I discovered that Apex SQL has given free fully functional version of their Apex SQL Studio for MCTs. I've just downloaded and activated the software. I will gove some notes on how it works and is it useful. Find out more about Apex SQL Studio at www.apexsql.com. April 11 Funny thing about SSIS debuggingToday I tried to debug some simple SSIS package. As I work with Visual Studio 2005 I often use F11 shortcut to perform step by step debugging of my .NET code. Below is what I saw after I pressed F11 while debugging SSIS package (the second sentence in English is "Not implemented"). Funny thing :-)
April 10 Get fragmented indexesIn SQL Server 2005 you can easily obtain some useful information about index fragmentation using system views and sys.dm_db_index_physical_stats dynamic management function.
April 08 SP2 is a messIs SQL Server 2005 Service Pack 2 really a mess? It seems most SQL Server users (including myself) think it is... Maciej Pilecki has given vent to his anger - read it here: https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=267610. I have just downloaded some update to SP2 (build 3159) but it seems there are three or even more of them (each one changes the version of SQL Server!!!). People in Microsoft - please give us SP3 ASAP. Or just give us one path to upgrade to a stable version... It's hard to believe that Maintenance Plans are the main reason of this mess. April 05 Permission for OPENROWSET BULKIf you're looking for permission type which allows you to use OPENROWSET BULK, then you're looking for ADMINISTER BULK OPERATIONS permission. Just grant it and you are ready to go with BULK. April 02 Eight new MVPs in Poland!!!It seems we have lots of experts in Poland. Yesterday, eight new Polish MVPs were awarded! There were two famous WSS portal members among those people - Konrad Sagala (MVP Windows Server System - Exchange Server) and Sebastian Wilczewski (MVP Microsoft Office SharePoint Server). Special congratulations for both of them!!! |
|
|