#1 Connectivity to SQL Azure

November 13, 2009

I’m enjoying the weekend, with Microsoft SQL Server R2 November CTP and its new features from Database engine features to Analysis Services features, Reporting Service features, etc…

I’ll post a series about those features en shaaa ALLAH in the next days, but let’s begin with Database engine features
#1 connectivity to SQL Azure: what’s SQL Azure? is a cloud-based relational database service built on SQL Server® technologies. To learn more about SQL Azure press here

First you need to have Microsoft SQL Server R2 November CTP, get all about it from here and SQL Azure account (I got it from Microsoft Connect)

1

Open SSMS, and using your Azure account (Server name, username and password) try to login
Read the rest of this entry »

Advertisements

SQL Server 2008 R2 November CTP3

November 11, 2009

SQL Server 2008

Updated on 11/11/2009 7:47 PM

Note: The download links below will launch the Akamai download manager which is designed to provide you with more control over your download experience.

Download now Microsoft SQL Server 2008 R2 November CTP http://care.dlservice.microsoft.com/download/7/B/4/7B4A1F68-4D05-42C1-8982-E5CD8492C6FA/SQLFULL_x86_ENU.exe

Microsoft SQL Server 2008 R2 add-in to Excel that allows very large sets of data to be manipulated efficiently aka Microsoft Gemini now its formal name is PowerPivot

Download: What’s New in SQL Server 2008 R2 November Community Technology Preview (CTP) http://www.microsoft.com/downloads/details.aspx?FamilyID=89550298-D564-40C5-B586-30DC3F909F6F&displaylang=en

It’s now available for download for MSDN and TechNet subscribers,  and it will be available to the general public on November 11th http://blogs.technet.com/dataplatforminsider/archive/2009/11/09/announcing-the-sql-server-2008-r2-november-ctp.aspx


SQL Server Business Intelligence webcast series

November 5, 2009

SQLServerGeeks.com cordially invites you to SQL Server Business Intelligence webcast series – with 4 webcasts spread over a week. This is an excellent opportunity to get an upstart with BI on SQL Server. The series is very well crafted with 4 webcasts looking into different facets of BI. If you know nothing about BI, do not miss the first webcast: BI for you. The four webcasts are detailed below. Register Fast. (For clarifications, please write to admin<at>sqlservergeeks<dot>com)
Webcast 1: BI for you
November 6, Friday, 3 pm to 4.30 pm
Webcast 2: Create your first cube
November 9, Monday, 3 pm to 4.30 pm
Webcast 3: Extract data from the cube
November 11, Wednesday, 3 pm to 4.30 pm
Webcast 4: Learn MDX scripting
November 13, Friday, 3 pm to 4.30 pm
To register & browse more details about each webcast, visit www.SQLServerGeeks.com/Events/SQLBIwebcasts.htm

SSIS insert bulk of data into remote table with trigger

November 4, 2009

hmmm, nice we have SSIS it makes life easier but it usually comes with non-understood problems like

“SQL Server Destination” (2185) failed with error code 0xC0202071 it means when you insert data into table in remote SQL Server don’t use SQL Server Destination component however use OLE DB Destination component, thank you SQL Server Central

Anyway I used OLE DB Destination component and everything went well but I found the trigger which updates something doesn’t fire simply because I do bulk insert and I should tell the BIDS please fire it.

So, right click on OLE DB Destination component then Show Advanced Editor… Component properties FastLoadOptions write FIRE_TRIGGERS

ssis postThank you Piotr Rodak


How to create Database User programmatically?

November 3, 2009

Well… we need to assign a server login to has access on a database, let’s say the SQL Server Login we had created programmatically should has access on database “Database1” and for some reasons we should do that programmatically

Well. Create any C# project type (Windows, Class Library or even Console one), add reference to Microsoft.SqlServer.Smo, and Microsoft.SqlServer.ConnectionInfo

/// <summary>

/// Creates database user

/// </summary>

private void CreateDatabaseUser(Database database, String username)

{

User sqlServerUser = new User(datawarehouseDatabase, username); //initializes new User object and we say to which database it belongs and its name

sqlServerUser .UserType = UserType.SqlLogin; //SqlLogin not anything else

sqlServerUser .Login = “login_name”; //associated the user to login name, login name should be valid login name

sqlServerUser .Create();//here’s we create the user on the database and till now the user don’t have any permission on database objects

sqlServerUser .AddToRole(“db_owner”); //or any role like db_databasereader, db_databasewriter,…

}

P.S: There’s catastrophic mistake in Microsoft documentation of User.Login as they documented it as ReadOnly field although it’s not.sqlloginHow we can call the above method?

Server sqlInstance = new Server(

new Microsoft.SqlServer.Management.Common.ServerConnection(

new System.Data.SqlClient.SqlConnection(“.”))); //connects to the local server

Database database = sqlInstance.Databases[“adventureworks”]; //initialize new object from database adventureworks

CreateDatabaseUser(database, “RamyMahrous”); //creates user RamyMahrous on database adventureworks