Profile cover photo
Profile photo
mahesh sharma
142 followers -
http://helpondesk.blogspot.com/
http://helpondesk.blogspot.com/

142 followers
About
Posts

Post has attachment
Add a comment...

Post has attachment
Add a comment...

Post has attachment
Get top X from each category SQL SERVER 2005 +
Get top 5 from each category simple logic use Row_Number function with partition by the category for which you want to create group.  ROW_NUMBER() OVER (PARTITION BY CategoryID order by CategoryID  ) Step 2: Now Row_Number will add numbers on each category,...
Add a comment...

Post has attachment
All Dates or Number series between start and end position
Example 1: Date Series DECLARE @StartDate  DATETIME ='20110501' ,         @EndDate    DATETIME= '20110801' SELECT  DATENAME(MONTH, DATEADD(MONTH, x.number, @StartDate)) AS MonthName FROM    master.dbo.spt_values x WHERE   x.type = 'P'       AND     x.number...
Add a comment...

Post has attachment
symbol lookup
NOTE: It is not working in IE & edge. <!DOCTYPE html> <html lang="en"> <head>  <meta charset="UTF-8" name="referrer" content="no-referrer" />     <meta name="viewport" content="width = device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"> ...
Add a comment...

Post has attachment
Executed Procedure name
select     db_name(st.dbid) as database_name,     object_name(st.objectid) as name    -- ,p.size_in_bytes / 1024 as size_in_kb,   --  p.usecounts,    -- st.text from sys.dm_exec_cached_plans p cross apply sys.dm_exec_sql_text(p.plan_handle) st where p.objty...
Add a comment...

Post has attachment
QL Server Agent Job Schedules
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 9...
Add a comment...

Post has attachment
how to restore MDF file
Resotring MDF file alone need trick. 1. to copy the mdf file login into DB server. 2. Stop the SQL serivice by clicking on servername. 3. copy and paste MDF file on other drive. 4. start the serive in SQL Jobs (Client) Login in to server where you want to s...
Add a comment...

Post has attachment
**
Get the deadlock Get the deadlock details SELECT XEvent.query('(event/data/value/deadlock)[1]') AS DeadlockGraph FROM ( SELECT XEvent.query('.') AS XEvent        FROM ( SELECT CAST(target_data AS XML) AS TargetData               FROM sys.dm_xe_session_targe...
Add a comment...

Post has attachment
Best use of cross Apply GL General ledger Debit Credit with negative values
CREATE TABLE #test (GLID varchar(10), Amt int) INSERT INTO #test (GLID, Amt) SELECT '1111', -100 UNION ALL SELECT '2222', 250 UNION ALL SELECT '3333', -300 UNION ALL SELECT '4444', 150 select * from #test select t1.GLID, (case  when t1.Amt < 0 then 0 else t...
Add a comment...
Wait while more posts are being loaded