http://feeds.feedburner.com/SpendYourTimeHere-Once

Current Affiares

Friday, July 20, 2012

How to disable copy and paste from javascript in textfield?

<head>
        <script language="javascript">
            function DisableRightClick(event)
            {
                //For mouse right click
                if (event.button==2)
                {
                    alert("Right Clicking not allowed!");
                }
            }
            function DisableCtrlKey(e)
            {
                var code = (document.all) ? event.keyCode:e.which;
                var message = "Ctrl key functionality is disabled!";
                // look for CTRL key press
                if (parseInt(code)==17)
                {
                    alert(message);
                    window.event.returnValue = false;
                }
            }
        </script>
</head>

<body>
  <h:inputText  onmousedown="DisableRightClick(event)" onkeydown="return DisableCtrlKey(event)" /> 
</body>

‎:::chand pal ka safar:::

ek pal hi mila ,aur jane kitne baate bata gaya koi,
chand pal ka safar, aur apna bana gaya koi,

kuch bhi karu to , wo yaad aata hai itna,
chand pal ka safar , aur haq zata gaya koi,

khilte na the phool, jis gulsan mai khabhi,
chand pal ka safar, aur bagiya laga gaya koi,

aarmaan mere bhi hai, pata nahi tha ham ko,
chand pal ka safar , aur sab bata gaya koi,

meri nazre uthti nahi,uske jaane ke baad,
chand pal ka safar, aur sharmana shikha gaya koi,




ATUL KUMAR MISHRA (CHANCHAL JI)
 

Monday, July 16, 2012

How to disable back button of your browser window through java script?

Que. How to disable back button of your browser window through java script?
Ans.
<head>
<SCRIPT type="text/javascript">
            window.history.forward();
            function noBack() { window.history.forward(); }
        </SCRIPT>
</head>
<body onload="noBack()"  onunload="">

how to rename table name?

sp_rename 'old_tablename' ,'new_tablename'

How to count no of duplicate record in a field of a table?

select count(*) as 'NoOfRecord',fname from test 
group by fname having count(fname)>1

Sunday, July 15, 2012

How to get a second largest salary from database?

How to get a second largest salary from database?

Below will work in all database----
select * from tablename t where 
2 =(select count(distinct id) from tablename  where t.id<=id)

Below will work in sql server and mysql only ---
select * from tablename where
 id = (select min(id) from 
(select top 3 id from tablename order by id desc) tb)

Wednesday, July 11, 2012

How to search date between two date?

select * from report_mstr where convert(varchar(10),modified_date,120)
between '2012-07-04' and '2012-07-11'
order by modified_date desc
;

How to get the last 7 days values of a datefield in sql server 2005?

Here is the last 7 days values query without including their time ---
report_mstr = table name
modified_date = datefield


select * from report_mstr 
where (convert(varchar(10),modified_date,120)
between convert(varchar(10),(getdate()-6),120) and convert(varchar(10),getdate(),120))
order by modified_date desc;


 --------
select getdate();
->>>> 2012-07-11 15:41:31.547
select getdate()-6; 
->>>>  2012-07-05 15:40:20.983
select convert(varchar(10),getdate(),120);
->>>> 2012-07-11

My Blog List

Popular Posts

All Rights Reserved To SYTHONCE. Ethereal theme. Powered by Blogger.