This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1 | |
SELECT d.name , convert (smallint, req_spid) As spid | |
FROM master.dbo.syslockinfo l, master.dbo.spt_values v, master.dbo.spt_values x, master.dbo.spt_values u, master.dbo.sysdatabases d | |
WHERE l.rsc_type = v.number and v.type = 'LR' and l.req_status = x.number and x.type = 'LS' and l.req_mode + 1 = u.number | |
and u.type = 'L' and l.rsc_dbid = d.dbid | |
and rsc_dbid = (SELECT TOP 1 dbid FROM master..sysdatabases WHERE name LIKE 'my_db') | |
SET @kill_process = 'KILL ' + @spid | |
EXEC master.dbo.sp_executesql @kill_process |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select cpu_count from sys.dm_os_sys_info | |
select scheduler_id,cpu_id, status, is_online from sys.dm_os_schedulers where status='VISIBLE ONLINE' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select * from sys.extended_properties | |
EXEC sp_addextendedproperty | |
@name = N'Description', | |
@value = N'بانک اطلاعاتی بانک'; | |
EXEC sys.sp_addextendedproperty @name=N'MS_Description', | |
@value=N'گروه مرجع' , @level0type=N'SCHEMA',@level0name=N'dbo' | |
EXEC sys.sp_addextendedproperty @name=N'MS_Description', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @name nvarchar(255) | |
DECLARE db CURSOR FOR | |
SELECT Name FROM sysdatabases | |
WHERE Name NOT IN ('master', 'tempdb', 'model', 'msdb') | |
OPEN db; | |
FETCH NEXT FROM db |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void Main(string[] args) | |
{ | |
ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Keyboard"); | |
var devs = managementObjectSearcher.Get(); | |
foreach (var o in devs) | |
{ | |
var dev = (ManagementObject) o; | |
Console.WriteLine("-----------------------------------------------------"); | |
Console.WriteLine(dev["Name"].ToString()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Flags()] | |
internal enum SetupDiGetClassDevsFlags | |
{ | |
Default = 1, | |
Present = 2, | |
AllClasses = 4, | |
Profile = 8, | |
DeviceInterface = (int)0x10 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class IsolatedStorageController | |
{ | |
private static readonly JsonSerializer Serializer; | |
private static readonly IsolatedStorageScope Scope; | |
private static readonly Type DomainEvidenceType; | |
private static readonly Type AssemblyEvidenceType; | |
static IsolatedStorageController() | |
{ | |
Serializer = new JsonSerializer(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Running & Scripting Migrations From Code | |
//https://romiller.com/2012/02/09/running-scripting-migrations-from-code/ | |
var configuration = new MyContextConfiguration(); | |
var migrator = new DbMigrator(configuration); | |
var scriptor = new MigratorScriptingDecorator(migrator); | |
string script = scriptor.ScriptUpdate(sourceMigration: null, targetMigration: null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXEC sp_resetstatus [YourDatabase]; | |
ALTER DATABASE [YourDatabase] SET EMERGENCY | |
DBCC checkdb([YourDatabase]) | |
ALTER DATABASE [YourDatabase] SET SINGLE_USER WITH ROLLBACK IMMEDIATE | |
DBCC CheckDB ([YourDatabase], REPAIR_ALLOW_DATA_LOSS) | |
ALTER DATABASE [YourDatabase] SET MULTI_USER |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
namespace SocialGoal.Data.Infrastructure | |
{ | |
public class Page | |
{ | |
public int PageNumber { get; set; } | |
public int PageSize { get; set; } | |
public Page() |