Venkatesan Prabu MCITP,MCAD,MCTS,CCNA. Worked as a ProjectLead(Senior .Net developer,SQL DBA). Now, Managing Director of KAASHIV INFO TECH, Chennai This Blog aims in serving the community in a better way. This blog is read by developers in 159 countries with average of 400 hits per day. Please post your valuable suggestions and hold my hand to serve the community. Lets make a new world with good thoughts and good minds....... This blog serves the SQL server community all over the world.
20.9.10
My session at Sydney Microsoft Office
In one word, “It’s a Marvellous evening”. Interesting part is, Adam Cogan is my fellow speaker. Working in Microsoft as a Technical Architect and as a Microsoft Regional Director too :-)
Presented my session in Microsoft office, Attended Adam’s session, Techie talks with hard core developers and finally my session is recorded and it will published soon in Microsoft portal.
To be frank, No words to express my joy…. In presenting an evening session to the techie experts in Microsoft, Sydney office.
Sydney Microsoft Office
Speaker’s desk
19.9.10
My Session in Sydney SQL User group
My presentation @ Greater Sydney.....
At last, it’s my dream evening. I gave a presentation to the SQL Server Gurus in Sydney…
Almost most of the attendees were having more than 15 years of experience in SQL Server :-)
They live with SQL Server technology. It was a pleasant moments and I have learnt a lot on meeting those technology Gurus.
Intro about me by Grant paisley (SQL Server MVP and Director of Angry Koala pty ltd)
My presentations starts with the query…. Can a DBA manage 100 Servers in One go???????
Discussion on Policy Creation and deployment Strategies
17.9.10
Dotnet and SQL Job in Hyderabad
Urgent requirement for ASP.Net professionals with a minimum experience of 3yrs in relevant field in Hyderabad.
Skills
ASP.Net 35 frame work, Ajax, sql.server 2005/2008, WCSF, classic ASP
Package: 2.4L - 3.0L
Location: Hyderabad
If anybody is interested Send your resumes to bobby.simson13@gmail.com
Cheers,
Venkatesan Prabu .J
16.9.10
Steps in loading your web contents - About browsers
Have you questioned yourself, why my browser is too slow ?????
To load the web page, your browser will traverse 11 sub systems or steps to display your web content :-) Interesting right !!! Let’s see,
1. Network – First subsystem which is responsible for client / server interaction. This relies on the hosted server’s performance and individual user’s network traffic.
2. HTML – Followed by the HTML – sub system. This allows you to download the HTML content from the server and structured it back to the client machine.
3. CSS – Cascade Style sheet, this will provide you the customised colouring and structure to the content. The details will be collected and it will be used later (In point 8).
4. Collections – Accessing metadata information related to your HTML. This guy will take care of Segregating your head and body contents separately.
5. Java script – Client side scripts which will execute based on the user’s action.
6. Marshalling – Java script engine can’t directly interact with the browser. Marshalling is a special communication layer between JavaScript engine and your browser.
7. DOM API – Special API’s responsible for interaction between JavaScript engine and your browser.
8. Formatting – All your objects will be formatted based on the CSS information collected.
9. Block building – Your objects will be segregated as separate blocks
10. Lay out formation – Now, depends on your Web parts or Frames or div tag or Table. Your layouts will be formed.
11. Image Rendering – Rendering of images (or) drawing to the screen through CPU or GPU.
Cheers,
Venkatesan Prabu .J
8.9.10
SQL Profiler InputBuffer events in SQL Server
1. Start your profiler and check it.
2. Check the process info for the server processes running.
3. In SQL Server 2008, you can opt Activity Monitor.
What else?????????
Here is another method using queries? If you got the spid then DBCC Inputbuffer command will provide you the last execution command of your user. Let's see how?????
Get the current session id
SELECT @@SPID
The output is, 51
Let's execute the below query now,
CREATE TABLE VENKAT_TABLE (Col1 int)
GO
DECLARE @i int;
SELECT @i = 0
BEGIN TRAN
SELECT @i = 0
WHILE (@i < i =" @i">
Now, open another session or connection, and execute the command
DBCC INPUTBUFFER (51);
You will get the last statement executed by the particular session user.
Usually, we will get confused on seeing the sequence of below statements in our profiler.
create table #tmpDBCCinputbuffer ([Event Type] nvarchar(512), [Parameters] int, [Event Info] nvarchar(512))
insert into #tmpDBCCinputbuffer exec ('DBCC INPUTBUFFER(51)')
select [Event Info] from #tmpDBCCinputbuffer
It's nothing but the in-house or profiler query itself. The above statements were used to fetch the latest statements of your server processes.
Cheers,
Venkatesan Prabu .J
Like operator on a column name in SQL Server
Hi Prabhu,
i need urgent help from you for sql script.
i have field called "Notes" in table ABC and have another table called XYZ.
XYZ table has five fields 1,2,3,4,5
the requirement is :
where 1=1
and abc.notes like '%xyz.1%'
and abc.notes like '%xyz.2%'
and abc.notes like '%xyz.3%'
and abc.notes like '%xyz.4%'
and abc.notes like '%xyz.5%'
did you understand?
notes field has some long strings... xyz table clumns string should match with that notes from the abc table.
how do i write the sql script.
becoz i have nearly 2000 records in the table.. can you help out plz....
its urgent.
thanks in advance
pinky
DROP TABLE PINKY1
DROP TABLE PINKY2
CREATE TABLE PINKY1(NOTES VARCHAR(100))
INSERT INTO PINKY1 VALUES('VENKAT')
INSERT INTO PINKY1 VALUES('VENKATESAN PRABU')
INSERT INTO PINKY1 VALUES('rENKAT')
INSERT INTO PINKY1 VALUES('AENKAT')
INSERT INTO PINKY1 VALUES('AENKAT')
INSERT INTO PINKY1 VALUES('zxNKAT')
INSERT INTO PINKY1 VALUES('zxNKAT')
INSERT INTO PINKY1 VALUES('zxNKAT')
INSERT INTO PINKY1 VALUES('VERESEAEz')
CREATE TABLE PINKY2(VAL1 VARCHAR(100),VAL2 VARCHAR(100),VAL3 VARCHAR(100),VAL4 VARCHAR(100),VAL5 VARCHAR(100))
INSERT INTO PINKY2 VALUES('VE%','%RE%','%SE%','%AE%','%E_')
INSERT INTO PINKY2 VALUES('BE%','%RE%','%SE%','%AE%','%E_')
INSERT INTO PINKY2 VALUES('SE%','%RE%','%SE%','%AE%','%E_')
INSERT INTO PINKY2 VALUES('DE%','%RE%','%SE%','%AE%','%E_')
SELECT * FROM PINKY1 INNER JOIN PINKY2 ON NOTES LIKE VAL1
WHERE NOTES LIKE VAL2 AND NOTES LIKE VAL3 AND NOTES LIKE VAL4 AND NOTES LIKE VAL5
Cheers,
Venkatesan Prabu .J
7.9.10
All about user creation in SQL Server
Goto SSMS -> New User. Provide your user name, in my case its sample_user
Choose the authentication and choose the default database.
Default database indicates the database to which the user is having the access. In the next page, you can specify the level of access to the user. The next drop down is Default language -> I have made it as default and it's English.
Arabic, Brazilian, British English, Bulgarian, Croatian, Czech, Danish are some of the languages listed.
In the next window, you can specify the role of the user and it's server role. I have informed that, this person is a sysadmin and public too.
Next option is "User Mapping", here all the database will be listed. You can specify the level of access to be provided to this user for each database.
Provide necessary access level in the database level. Make the user as public for that specific database. Now click "OK". Reopen the login page for that particular user. "VenkatDB" is disappeared.
Now, I am trying to access the objects in the database. Below is the message received.
Database size in Express editions
SQL Server 2008 Express editions - Database size is 4 GB
SQL Server 2008 R2 Express editions - Database size is 10 GB
Cheers,
Venkatesan Prabu .J
Check the Updates in our machine
On selecting the check box, you will see a fantastic difference in listing the installed softwares.
It's a tree nature display which will give the information like which one is the master one and what all the patches applied on it.
Select Statements to access stored procedures
statement in functions whereas we can't use the same in stored procedures.
Specify whether it's SQL Server or not. If it's not SQL Server, provide necessary details to connect it.
The third window specifies the options to be provided for the Linked server. If everything is good. Click "Ok" button.
Now, your Linked Server is created.
SELECT * FROM LinkedServer.VENKATDB.dbo.VENKAT_TABLE
Am able to see my data.
DROP TABLE VENKAT_TABLE_LINKED
CREATE TABLE VENKAT_TABLE_LINKED (ID INT)
INSERT INTO VENKAT_TABLE_LINKED VALUES (1)
INSERT INTO VENKAT_TABLE_LINKED VALUES (2)
INSERT INTO VENKAT_TABLE_LINKED VALUES (3)
INSERT INTO VENKAT_TABLE_LINKED VALUES (4)
GO
DROP PROCEDURE VENKAT_PROCEDURE
GO
CREATE PROCEDURE VENKAT_PROCEDURE
AS
BEGIN
SELECT * FROM VENKAT_TABLE_LINKED
END
GO
EXEC VENKAT_PROCEDURE
GO
SELECT * FROM OPENQUERY ([LinkedServerName],'MASTER.DBO.VENKAT_PROCEDURE')
6.9.10
Linked servers in SQL Server
It's quite a different area, which I would like to concentrate more. What's this???? linked server......
Accessing the resource in the other server can be achieved using Linked server. Considering am having a server named "ServerA" and I would like to grab some data from the remote server named "ServerB". In that case, we need to create a linked server. In our scenario, the linked server is "ServerB".
Let's see, How to link it? How to access the data?
Goto SSMS -> Your DB Server -> ServerObjects -> Linked Server - > Create new Linked Server.
You will get a message box to type your Linked server. You need to provide the servername.
Specify whether it's SQL Server or not. If it's not SQL Server, provide necessary details to connect it.
SQL Server installation issue with Windows XP sp3
I happened to install SQL Server in Windows XP sp3 version. Oops, I couldn't make it out.
1. Am facing issue with MSXML6.
2. Because of the above point, workstation components and Database services were not installed in my machine.
Reason for this issue:
MSXML6 is trying to change the language settings of WindowsXP sp3 which it couldn't succeed. So the installation is failing. Looks like, it's a well know bug.
Just checking for the workaround, I found the below blog which may be useful for you. Please check it out,
Cheers,Venkatesan Prabu .J
5.9.10
Format files in SQL Server
Am having a table named Venkat_table
We should go to the Windows command prompt and execute the above command, a file will be generated in the desired location.
My T-SQL Gallery @code.msdn.microsoft
Created my own T-SQL Gallery in Microsoft site. Do visit the same and share your feedback,
http://code.msdn.microsoft.com/VenkatSQLSample/Thread/List.aspx
Thanks and Regards,
Venkatesan Prabu .J
SQL Server Interview questions - Part 1
Null means no entry has been made. It implies that the value is either unknown or undefined.We should avoid permitting null values because Column with NULL values can't have PRIMARY KEY constraints. Certain calculations can be inaccurate if NULL columns are involved.
What is SQL whats its uses and its component ?
The Structured Query Language (SQL) is foundation for all relational database systems. Most of the large-scale databases use the SQL to define all user and administrator interactions. It enable us to retrieve the data from based on our exact requirement. We will be given a flexibility to store the data in our own format.
The DML component of SQL comprises four basic statements:
* SELECT to get rows from tables
* UPDATE to update the rows of tables
* DELETE to remove rows from tables
* INSERT to add new rows to tables
What is DTS in SQL Server ?
Data Transformation Services is used to transfer the data from one source to our required destination. Considering am having some data in sql server and I need to transfer the data to Excel destination. Its highly possible with dialogue based tool called Data Transformation services. More customization can be achieved using SSIS. A specialized tool used to do such migration works.
What is the difference between SQL and Pl/Sql ?
Straight forward. SQL is a single statement to finish up our work.Considering, I need some data from a particular table. “Select * from table” will fetch the necessary information. Where as I need to do some row by row processing. In that case, we need to go for Procedural Logic / SQL.
What is the significance of NULL value and why should we avoid permitting null values?
Null means no entry has been made. It implies that the value is either unknown or undefined.We should avoid permitting null values because Column with NULL values can't have PRIMARY KEY constraints. Certain calculations can be inaccurate if NULL columns are involved.
Difference between primary key and Unique key?
Both constraints will share a common property called uniqueness. The data in the column should be unique. The basic difference is,
· Primary key won’t allow null value. Whereas, unique key will accept null value but only one null value.
· On creating primary key, it will automatically format the data inturn creates clustered index on the table. Whereas, this characteristics is not associated with unique key.
· Only one primary key can be created for the table. Any number of Unique key can be created for the table.
Select Statement in SQL Server
String Functions in sql server
SQL Server Interview Question - Part 2
What is normalization?
Normalization is the basic concept used in designing a database. Its nothing but, an advise given to the database to have minimal repetition of data, highly structured, highly secured, easy to retrieve. In high level definition, the Process of organizing data into tables is referred to as normalization.
What is a stored procedure:
Stored procedures are precompiled T-SQL statements combined to perform a single task of several tasks. Its basically like a Macro so when you invoke the Stored procedure, you actually run a set of statements. As, its precompiled statement, execution of Stored procedure is compatatively high when compared to an ordinary T-SQL statement.
What is the difference between UNION ALL Statement and UNION ?
The main difference between UNION ALL statement and UNION is UNION All statement is much faster than UNION,the reason behind this is that because UNION ALL statement does not look for duplicate rows, but on the other hand UNION statement does look for duplicate rows, whether or not they exist.
Example for Stored Procedure?
They are three kinds of stored procedures,1.System stored procedure – Start with sp_2. User defined stored procedure – SP created by the user.3. Extended stored procedure – SP used to invoke a process in the external systems.Example for system stored proceduresp_helpdb - Database and its propertiessp_who2 – Gives details about the current user connected to your system. sp_renamedb – Enable you to rename your database
What is a trigger?
Triggers are precompiled statements similar to Stored Procedure. It will automatically invoke for a particular operation. Triggers are basically used to implement business rules.
What is a view?
If we have several tables in a db and we want to view only specific columns from specific tables we can go for views. It would also suffice the needs of security some times allowing specfic users to see only specific columns based on the permission that we can configure on the view. Views also reduce the effort that is required for writing queries to access specific columns every time.
What is an Index?
When queries are run against a db, an index on that db basically helps in the way the data is sorted to process the query for faster and data retrievals are much faster when we have an index.
What are the types of indexes available with SQL Server?
There are basically two types of indexes that we use with the SQL ServerClustered -
1. It will format the entire table, inturn physically sort the table.
2. Only one clustered index can be created for a table.
3. Data will be located in the leaf level.
4. By default, primary key will create clustered index on the table.
Non-Clustered Index
1. It wont touch the structure of the table.
2. It forms an index table as reference to the exact data.
3. A reference to the data will be located in the leaf level.
4. For a table, we can create 249 non clustered index.
Happy Learning!!!
Regards,
Venkatesan Prabu .J
SQL Interview question
Extent Vs Page?
Pages are low level unit to store the exact data in sql server. Basically, the data will be stored in the mdf, ldf, ndf files. Inturn, pages are logical units available in sql server.The size of the page is 8KB.
Eight consecutive pages will form an extent 8 * 8KB = 64KB.
Thus I/O level operation will be happening at pages level.The pages will hold a template information at the start of each page (header of the page).
They are,
1. page number,
2. page type,
3. the amount of free space on the page,
4. the allocation unit ID of the object that owns the page.
Extents will be classifed into two types,
1. Uniform extents
2. Mixed extents
Uniform Extents:It occupied or used by a single object. Inturn, a single object will hold the entire 8 pages.Mixed
Extents:Mulitple objects will use the same extent. SQL Server will allow a max of eight objects to use a shared extent.
Property of SQL Server :Initally if an object is created, sql server will allocate the object to the mixed extent and once if the size reaches 8 pages and more... immediately, a new uniform extent will be provided for that particular object.
Herecomes, our fragmentation and reindexing concepts.