Introduction:
Advantages:
- Fast /High Performance
- Very popular
- Horizontally scalable
- Light weight
Disadvantages:
- Less features.
- No Joins
I am excited i got windows azure subscription, i couldn’t stop myself to create a SQL Server Instance in cloud. Here is my small experience with cloud. Lets create SQL Server instance and access from our client SSMS(SQL Server Management Studio).
Step 1: Go to your portal:
Step 2: Click on +New (Quick Launch for Services) Or SQL Database Symbol on Left pane:
If you click on new, this will give you quick launch of cloud services. You can choose your services like compute (create website, Virtual Machine, Virtual Network, Mobile Services), Data Services (Create Database, Storage, Big-data etc), App Services etc.
Step 3: Choose Data Services/SQL Database/Quick Create:
Step 4: Server is ready:
Then you can see a progress bar there in the portal and at bottom as well. Once that is created we can customize as well. Keep in mind this user name and password will be useful connecting server from client side.
Step 5: Give access to your client machine to access through SSMS:
Click on server name as marked in below image.
You get to another page where you can allow access to clients ip address. Here you can see three textboxes, enter computer name (for your reference only) then starting range of IP and ending range of IP.
You can get your client IP of your system by typing “my IP” in Google; this I thought would be simplest.
Then save the changes. Now if you have given permission for your computer IP then you will be able to use SSMS to connect to the server from the permitted client machine.
Once Server is ready then we can access this database even from our client SSMS tool. For that you need Server Name. For that follow next step.
Step 6:Let’s find server name:
Click on Manage as shown below.
Copy this completely like “xxxxxxxxxxx.database.windows.net”. This is Server name.
Let’s try connecting to the server via SSMS in permitted client machine. As you can see I have given server name as copied as explained in above step.
There you are connected with the server, now you can do all operation in your machine and the changes will be saved in your server created in cloud.
Now you have created a SQL Server Instances in cloud. Enjoy SQL coding…..
Nested transaction is nothing but, you can make another transaction without even committing/Rollback previous transaction. With Every begin the value of @@Trancount increases by one and this is counter balanced by commit statement. As shown in image below. But in case of rollback it directly falls back to zero.
Lets experiment this;
Assume i have a table “Columns_for_Transaction_Example” having some values in it
Begin Nested Transaction:
here the value of Trancount will become 1. And new value would be like this as shown below
Let’s begin another transaction:
now Trancount will change to 2
lets check the value in table after the update, as we can see offset value will become 0.
so now lets commit one by one , As shown in transaction tree figure trancount will decrease one by one ,can’t reduce to zero directly.
similarly if we do rollback,Trancount decreases directly to zero As shown below.
Well i am learning transaction these days, So thought of sharing my earnings with all. well this is very useful when we need to have good control on transaction. Or in case of failure/error we can handle the transaction like roll back the changes . During learning process i referred couple of blogs and MSDN as well.
Transactions:
Basically as simple it is, transaction is any task performed in SQL Server by our command given. To be precise smallest unit of task called transaction. For example, reading data from table, inserting data to the table we say its transaction.
When we use select statement, we read data. It’s transaction. We update table, again we enter data to the specified table its transaction. Similarly we give any command from SSMS, read data or write information to memory/Table.
Transactions are having standard property called ACID:
Sometimes we need to control over the transactions we made, thus SQL provides some commands to us, to control the transaction for DML (Select, Insert and Update). These commands are:
This becomes Important to talk about Global Variable @@TRANCOUNT when we are discussing about Transactions. This is the variable which keeps the value ,or number of times Transaction happened which is not yet committed. If there is no Transaction then value in this variable would be zero.
We can discuss about this in Next blog.