.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Using ExecuteSQL to create a new policy in SQL Server 2008

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :Sql Server

Trying to create a new Policy in Policy Based Management within SQL Server 2008 to show any users with elevated privileges.

Uisng the following SQL:


('String', 'SELECT p1.[name] as principal_name,p1.[type_desc],p2.name as role_name

FROM [master].[sys].[server_principals] p1

join [master].[sys].[server_role_members] r

on p1.principal_id = r.member_principal_id

join [master].[sys].[server_principals] p2

on r.role_principal_id = p2.principal_id

where p2.type_desc = 'SERVER_ROLE'

and p2.name <> 'sysadmin'

and not exists

(select *

from uhtdba.dbo.server_role_member_exception ex

where ex.principal_name = p1.name

and ex.role_name = p2.name)


View Complete Post

More Related Resource Links

Can't Create ODBC to Local SQL Server Express 2008

Hello. I have SQL Server Express 2008 SP1 LOCALLY on my Windows XP Professional SP3 box. I have databases already created in Access 2007 that I imported into SQL. Now I want to keep the front end Access forms for data entry but have them connect to the databases in SQL. What I can't seem to do is connect from Access to the SQL db's because I can't create the ODBC connection. When I try to connect, I get the following two 'Connection failed' errors: 1. SQLState: '08001' SQL Server Error: 10061 [Microsoft][SQL Server Native Client 10.0]TCP Provider: No connection could be made because the target machine actively refused it. 2. SQLState: 'HYT00' SQL Server Error: 0 [Microsoft][SQL Server Native Client 10.0]Login timeout expired Additionally, this information may help. 1. Windows firewall is turned off. 2. In SQL Server Configuration Manager > SQL Server Network Configuration > Protocols for SQLEXPRESS, Shared Memory, Named Pipes and TCP/IP are all 'Enabled'. The order is Shared Memory (1), Named Pipes (2) and TCP/IP (3). 3. In SQL Server Configuration Manager > SQL Native Client 10.0 Configuration > Client Protocols, the above three are also 'Enabled'. The order is Shared Memory (1), Named Pipes (2) and TCP/IP (3). Double-clicking TCP/IP tells me that the default port is 1433. 4. Running "netstat -ano", I see no entries for [myIPaddress]:1433.

Unable to create Web Folders in Windows Server 2008 R2

Hi, We are unable to create web folder from a Windows Server 2008 R2 system as we do in Windows XP. The web url cannot be identified. The web url is an oracle repository application built in 32-bit OS and now we need this to be added in Windows Server 2008 R2 machine. Kindly help.  

Cannot Create Database Diagrams - SQL Server 2008 Management Studio

I cannot create a database diagram with my client-side SQL Server Management Studio.  I can do this if I am on the actual db server itself.  Please help.

(SQL Server 2008) Exporting entire databases to SQL CREATE/INSERT statements

Hi All, I'm looking for a way to export SQL Server 2008 (Express or otherwise) databases to CREATE/INSERT statements.  I've seen a million threads (give or take) with instructions for creating large (often illegible) TSQL scripts for the task.  However, I'm hoping that this isn't the only way by which to do it.  I have need to regularly back up the data from existing MS SQL Server DBs (which are used by some of our standard apps) to various other MySQL and PostgreSQL databases (which are used by PHP and Rails web front ends).  I need to export them from MS SQL Server 2008 to a general format (i.e. INSERT statements) and perform regex edits on the file as necessary. FYI, I've written a few applications that connect to the various DBs over ODBC, etc. and transfer the data row by row.  You can image how painful this process is... I realize that there are many tools that do this.  However, most of them approach the issue from the standpoint of migration, and not that of regularly scheduled backups.  Also, this tool will need to eventually be distributed so having to purchase a license for the migration app for each person/group simply isn't feasible. Anyway, if you guys have a quality, straightforward solution to this issue, it would certainly be appreciated. Best.

please help me to create database in sql server 2008

hi,    i am new to asp.net. i like to learn asp.net and c#. when i try to connect to sql server, it asks server name. i don't know server name and it asks database name also. how to create database and where can i access like phpmyadmin. in phpmyadmin i can create database and tables. i am new to this. please help me.thanks.  

How to create a SSIS package to import records form SQl Server 2008 tables to text files

I am a newbie to SSIS and would like to create a package to accomplish the task referenced in the above title. Will appreciate any links and pointers in the right direction.   Thanksakoranteng

Create new instance of sql 2008 R2 server

Is there a way to create a instace of sql server just using my pc name? Currently sql uses 'machine name\instance name'

SQL SERVER 2008 Create Maintenance Plans encounter General Access Denied error


After I clicked New Maintenance Plans and filled in <Maintenance Plans Name>, an error appeared like below: General access denied error, my account is already sysadmin and public, and agent service has started.


TITLE: Microsoft SQL Server Management Studio


General access denied error


General access denied error



How to create linked Server to connect from SQL Server 2008 to SQL Server 2000


How to create linked Server to connect from SQL Server 2008 to SQL Server 2000.

I following the steps to create the linked server in the GUI but failed with the following error message.

I used the full computer network name as the 'Linked Server' name

 OLE DB provider "SQLNCLI10" for linked server "my_server_network_name" returned message "Unspecified error".
OLE DB provider "SQLNCLI10" for linked server "my_server_network_name" returned message "The stored procedure required to complete this operation could not be found on the server. Please contact your system administrator.".
Msg 7311, Level 16, State 2, Line 1
Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI10" for linked server "my_server_network_name". The provider supports the interface, but returns a failure code when it is used.

Thanks a lot for your help.


SQL Server 2008 Management Studio - "Show policy health state for all nodes"

What does "Show policy health state for all nodes" option do in SQL Server 2008 under the Object Explorer?

Screen Shot

SQL Server 2008 R2 Enhancements to Policy-Based Management


I'm reasearching enhancements which have been made to Policy-Based Management in SQL Server 2008 R2.  I"ve found several articles and posts on PBM in general, but nothing that explicitly describes what enhancements have been implemented in SQL 2008 R2 which are not available in SQL 2008.  Does anyone know of any white papers or articles which discuss this?

Domain groups in Cluster Security policy during install of SQL Server 2008

I am trying to install SQL Server 2008 on Windows server 2003 and have a question about the stage of 'Cluster Security Policy'.

We need to select 2 groups here, one for SQL server database domain group and the other for SQL server agent domain admin group.

My question is, is it different from service accounts that we used to specify in previous versions? I remember the wizard asking for service account that the sql services need to run under. Is this domain group part a replacement for those individual service accounts? If yes, do I need to have the service account added to a separate group and select that group in this part of 'Cluster security policy'?


Cluster Security Policy -- Configuration in SQL Server 2008 R2 (Side by Side with SQL Server 2000


Hi all

Please I have SQL Server 2000 running on Windows 2003 SP2 (A/P) Cluster,Now we are adding new SQL Server 2008R2 Instance to Cluster.

I want know "Database Engine Domain Group","SQL Server Agent Domain Group" section,can I select excisting SQL Server 2000 Engine Domain group or I required to Configure  some thing else.


How to find out "Database Engine Domain Group","SQL Server Agent Domain Group" of  excisting SQL Server 2000.


Thanks in Adavnce




create subscription on client creates no entry in Sync Center if there is another SQL Server 2008 R2


We created a publication on SQL Server 2008 R2 (Dev. Edition). Then we tried to create a pull-merge subscription on the client which should create an entry in Synchronization Center (Win 7) as well under Windows Explorer – Synchronization (Win XP).


This scenario works if there is only our instance of SQL Server installed on the client.

If there is another instance (default or another named instance) installed before we create our instance with subscription there is following strange situation:


-       Subscription is created properly within Management Studio, property for showing in sync center set to enabled.

-       No entries created in Synchronization Center or Win Explorer Synch.

-  &nbs

sql server 2008 r2 install does not create database engine, also mmc creates error "Failed to create


I am loading sql server 2008 r2 developer edition into Windows Vista Home Basic. Product loads correctly with no error messages; except will not create database engine. And will not create integration services. When I try to open MMC, I will get error "MMC could not initialize the snap-in. Product may not have been installed correctly."

I understand this is a known issue for SQL Server 2008 RD installing on Windows Vista? What is the workaround or fix? Hot fixes available for this issue from support.microsoft.com do not install on my Windows Vista Home Basic machine.


Problem to create visual studio 2008 environment in windows server 2008


I am working on FTS (File Text Search) for file extension like .doc, docx, ppt, pptx, txt, pdf.

For developing FTS I used environment:

Development IDE:  Visual Studio 2008

Language: C#


Connestion string create any database server

This links important to how to create connection string to any data base sever.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend