Friday, 25 October 2013

Find the last modified date for all stored procedures


-- SQL stored procedure last modified date - SQL datetime to string conversion

USE AdventureWorks2008;  

GO
 
SELECT   SchemaName = Schema_name(schema_id),
         SprocName = name,
         CreateDate = left(convert(varchar,create_date, 120),10),
         ModifyDate = left(convert(varchar,modify_date, 120),10)
FROM     sys.objects
WHERE    TYPE = 'P'
         AND is_ms_shipped = 0
ORDER BY SchemaName,
         SprocName
GO




For  above example the out put is like below .

OUT PUT:   

SchemaName        SprocName                     CreateDate  ModifyDate
HumanResources    uspUpdateEmployeeHireInfo     2016-01-11  2016-03-10
HumanResources    uspUpdateEmployeeLogin        2016-01-12  2016-02-16
HumanResources    uspUpdateEmployeePersonalInfo 2016-01-17  2016-06-12 

Saturday, 13 April 2013

How to find the 5 th MAX Salary in sql server 2008



create table Employee2000 (eno int,ename varchar(30),Sal int );

insert into Employee2000 values (1,'ANIL',25000)
insert into Employee2000 values (2,'SUNIL',24000)
insert into Employee2000 values (3,'Rajesh',23000)
insert into Employee2000 values (4,'Kamesh',22000)
insert into Employee2000 values (5,'RUPESH',21000)










select sal from Employee2000 e1 where 4=(select COUNT(*) from Employee2000 f1 where e1.Sal<f1.Sal)



How to find the N th record in sql server 2008


SQL_DBA- Ip Address Ping

Start-Transcript - path C:/Script/PingLog.txt -Append   Ping.exe -t spiceworks.com | ForEach { "{0} - {1}" -f (Get-Date), $_ } ...