Pages

Social Icons

Monday 10 February 2014

Physical Path of Database in SQL

Hi All,

Below are the two queries which help us to find the full path of the data folder in SQL.

This query Return Full physical path till Data Folder in SQL
                                                         
SELECT SUBSTRING(FILENAME, 1, CHARINDEX(N'<database_name>', LOWER(FILENAME)) - 1)
FROM master.dbo.sysdatabases WHERE name = '<database_name>'

This query Return Full physical path till Data Folder in SQL for all the database present in sql

SELECT
   mf.name
  ,mf.physical_name
  ,reverse(left(reverse(physical_name), charindex('\', reverse(physical_name)) -1))

 FROM sys.master_files mf 

Thanks,
RS

Friday 7 February 2014

How to download and save Facebook look back video

Hi All,

Facebook has presented the feature of creating a look back video.

If you want to download this video then you have to follow the below steps.

1. You should have Google Chrome install in your computer.
2. Open your facebook look back video or login to facebook and click on https://www.facebook.com/lookback/ in google chrome and press Ctlr+Shift+J key.
3. Now Copy the below code and paste in the window which is coming after step 2 then Hit Enter.

var xmlhttp;

if (window.XMLHttpRequest) {

xmlhttp = new XMLHttpRequest();

} else {

xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
ss = xmlhttp.responseText.split('[["params","')[1].split('"],["width","960"]')[0];
var x = ss;
var r = /\\u([\d\w]{4})/gi;
x = x.replace(r, function (match, grp) {return String.fromCharCode(parseInt(grp, 16)); });
x = unescape(x);
console.log(JSON.parse(x).video_data[0].hd_src);
prompt("Here's your video URL (HD)! Press Ctrl + C to copy it!", JSON.parse(x).video_data[0].hd_src)
}
}
xmlhttp.open("GET", "/lookback", true);
xmlhttp.send();
4. Now one popup will come with the url. Copy that url and paste it into new tab.
5. Now Hit Ctrl + S and save the video.
Thanks,
RS

Thursday 6 February 2014

Add error messages in SQL-Server

Hi All,

Below is the example how we can add our own error messages in SQL-Server.

Que: I want to add my own error message in sql server what can I do for this.

Ans: We can defined our own error using sp_addmessage. Below is the syntax.

exec sp_addmessage 50001,16, 'Hello Rahul Singi'

Now when we will raise the error 50001 we will get the message “Hello Rahul Singi”

--- output ---
Msg 50001, Level 16, State 1, Line 2

Hello Rahul Singi

Thanks,
RS