SQL SERVER – Q and A from Facebook Page

Social media has changed everything, there were times when we used to send emails but nowadays things have changed. We all have many different ways to connect with each other. Here are a few questions which I have received on the Facebook Page in the month of the march and I am sharing a few of them here.

Q: How to change collation of the our entire server? (link)
A: You will have to install your entire SQL Server to change collation of the server.

Q: How to recover system databases from suspect mode without having any backups? (link)
A: You need backup to recover a corrupt system database.

Q: How to retrieve last 5 inserted rows from a table? (link)
A: You can retrieve the data based on date field or identity field. If you do not have either, no luck. (blog)

Q: What does *= operator does for SQL Query? (link)
A: It is an old way of using left join, now it is deprecated so avoid using it.

Q: How to reduce CXPACKET and PAGEIOLATCH_XX waits in SQL Server database? (link)
A: CXPacket is the effect of parallelism, which may or may not be a problem. PageIOLatch indicates a problem with the slowness of the disk subsystem. This would very well cause CXPacket as well. (blog, blog)

 Well, these are the five questions which I have received on Facebook. If you have any question, let us connect on Facebook.

Reference: Pinal Dave (http://blog.sqlauthority.com)

About these ads

SQLAuthority News – FQL – Facebook Query Language

I was exploring the new hype (promoted by Robert Scoble heavily) today, I found Facebook Developers Documentation very interesting. Facebook API can be queries using FQL – Faceboook Query Language, which is similar to SQL.

Facebook list following advantages of FQL:

  • Condensed XML reduces bandwidth and parsing costs.
  • More complex requests can reduce the number of requests necessary.
  • Provides a single consistent, unified interface for all of your data.
  • It’s fun!

A sample query in FQL looks like
SELECT concat(first_name, substr(last_name, 0, 1), " is from "
UPPER(hometown_location.city), ", yo", status
FROM USER
WHERE uid IN (
SELECT uid2
FROM friend
WHERE uid1 = [uid])
AND
strlen(hometown_location.city) > 0
AND status.time > now() - 3600*6

Refer the FQL documentation for table list which can be used in FROM clause for query as well functions and operators allowed in FQL. FQL does not support complex tables joins yet. I am quite impressed with the new attempt to have SQL like query in facebook.

Reference : Pinal Dave (http://blog.SQLAuthority.com)