Jun 1, 2015

Lost all SQL Admin logins -- this command comes to my rescue.

PsExec -s -i "C:\Program Files (x86)\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"

This will use Network Service to Login and you can add new login one you logged in through,


​Note: SSMS.exe path may differ, please check on your drive for SQL Installed Binn.​

May 15, 2015

Deleting performance Category via Power shell.

​Its worked perfectly fine for me.
[Diagnostics.PerformanceCounterCategory]::Delete( "Perf Category Name" )

Jan 11, 2014

I am back now :)

After a long time, I am thinking to write again.. Hope I can continue writing :)

Dec 7, 2011

Best Practice for deleting large records from a table

Request Timed out for Large Table records delaetion.
Even sometime it sayes Transaction Logs Full, or sometime Memory Issues...
So here i get the Best Practice for deleting large records from a table...

WHILE (SELECT COUNT(*) FROM <table name> WHERE [Filter Condition] > 0
BEGIN
DELETE TOP 10 FROM <table name> WHERE [Filter Condition]
END


Oct 12, 2011

Debug (F5) Global.asax.cs Application_Start() Method

Many Times we need to debug the Application_Start on server where we can not debug with Visual Studio IDE, instead we use CLR Debugger. So debugging on Global.asax.cs is deifficult as you need to attach the W3WP process, but it starts only when your application get a first hit, and so Application_Start code already executed. So how we can debug ??
So I was reading few discussion over mail thread when I came across this wonderful ideas.
(Hey Guys accept my thanks and from others as well [who read this ] for your good debugging tricks.)
So here we goes -
  1. Put delay in Application_Start Methods first Line as approx. you need to attach the debugger.
  2. #if DEBUG
                       if(ApplicationSetting("DebugStartup"))
               System.Diagnostics.Debugger.Break();
            #end if

Aug 5, 2011

Iftaar Timing Noida Delhi 2011


Noida & Delhi

Date

Day

Sehar

Iftar

Date

Day

Sehar

Iftar

2-Aug

Tue

4:16

7:12

17-Aug

Wed

4:28

7:00

3-Aug

Wed

4:17

7:12

18-Aug

Thu

4:29

6:59

4-Aug

Thu

4:18

7:11

19-Aug

Fri

4:30

6:58

5-Aug

Fri

4:19

7:10

20-Aug

Sat

4:30

6:57

6-Aug

Sat

4:19

7:09

21-Aug

Sun

4:31

6:56

7-Aug

Sun

4:20

7:09

22-Aug

Mon

4:32

6:55

8-Aug

Mon

4:21

7:08

23-Aug

Tue

4:32

6:54

9-Aug

Tue

4:22

7:07

24-Aug

Wed

4:33

6:53

10-Aug

Wed

4:23

7:06

25-Aug

Thu

4:34

6:52

11-Aug

Thu

4:23

7:05

26-Aug

Fri

4:35

6:50

12-Aug

Fri

4:24

7:04

27-Aug

Sat

4:35

6:49

13-Aug

Sat

4:25

7:03

28-Aug

Sun

4:36

6:48

14-Aug

Sun

4:26

7:03

29-Aug

Mon

4:37

6:47

15-Aug

Mon

4:26

7:02

30-Aug

Tue

4:37

6:46

16-Aug

Tue

4:27

7:01

31-Aug

Wed

4:38

6:45


Jun 26, 2011

MOTHERS & CHILDRENS


Pencil: I'm sorry
Eraser: For what? You didn't do anything wrong.
Pencil: I'm sorry cause you get hurt because of me. Whenever I made a mistake, you're always there to erase it. But as you make my mistakes vanish, you lose a part of yourself. You get smaller and smaller each time.
Eraser: That's true. But I don't really mind. You see, I was made to do this. I was made to help you whenever you do something wrong. Even though one day, I know I'll be gone and you'll replace me with a new one, I'm actually happy with my job. So please, stop worrying. I hate seeing you sad. :)

I found this conversation between the pencil and the eraser very inspirational.

Mother is like the eraser whereas their children are the pencil.
She is always there for their children, cleaning up their mistakes.
Sometimes along the way...  She get hurt, and become smaller (older, and eventually pass on).
Though her children will eventually find someone new (spouse), but she is still happy with what she do for their children, and will always hate seeing her precious ones worrying, or sad.
This is to all the MOTHERS & CHILDRENS..............!!!!!!!!!!!!!!!!!
Ref: Dont know the origin but I get it from Ahsan
P.S. Thanks a lot (whomsoever compose it) for writing such a wonderful inspirational message..

Feb 20, 2011

How to pass variable to sql script from batch file?


How to pass variable to sql script from batch file?
1.       Create a Table called Employees
id int
fname varchar(50)
lname varchar(50)
dept varchar(10)

2.       Insert few records into it as
Id            fname                   lname                   dept
01           Mohd                    Irfan                      IT
02           Gaurav                  Thakur                  IT
03           Animesh              Mishra                  Security
04           Ashok                   Roy                        Admin
3.       Create the sql script as getEmployees.sql
use $(dbname)
select * from $(tablename)

4.       Create the runsqlscript.bat file for running the sql script as below.
sqlcmd -S %1 -i getEmployees.sql -v dbname = %2 tablename = %3 -o %4

5.       Run this command from cmd.
>runsqlscript.bat SQLServerName DBName Employees D:\EmployeesList.txt


Sep 2, 2010

HCL Care Noida

Hcltouch Number for Noida - 18601800425
For Desktop - Monday to Saturday 9:00 AM to 5:00 PM
For Labtop - 24x7
 

Mar 18, 2010

Equivalent SQLWB Command in SLQ 2008

Run command for opening SQL2005 management studio is SQLWB, however the same is not availabl ein sql 2008.
So what is the run command for SQL 2008
 
 
Its SMSS
 
Go to Start -> RUN
Type SSMS
Click Enter
 
And here you are with SQL2008 Management Studio.
 
 

Jan 22, 2010

It is possible to have dynamic query in LINQ?

It is possible to have dynamic query in LINQ?

var data = items in ItemsList
where items='some condition'
select items;


The above query is static query as its already written and it will be executed good.

I wanna know if we can make the same query into some string and exec the same??

Jan 18, 2010

Can SQL Mirroring be implemented on .NET 1.1

The straight answer is NO, let me find some tweeks and update this topic.

And yes its true, for mirroring , failover implementation it need to provide the failover partner into the connection string which is not supported for .NET Framework 1.1 and 1.0.


http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx


Key: Failover Partner
Default Value : N/A
Description: The name of the failover partner server where database mirroring is configured.
The Failover Partner keyword is not supported by .NET Framework version 1.0 or 1.1.

Jan 15, 2010

Database Mirroring Vs Database Replication [SQL 2005 and Above]


Database Mirroring

Database Replication

Making the same database with transaction logs [ synchronous or asynchronous]

Making the same database replicated on other server.

Only snapshot can be used to fetch the data from mirroring server.

Can be fetched data directly from the replicated server.

Mirroring is preferred when we want database online most of the time.

Replication used when we need to run the reports without affecting the primary database performance.

In case of failover the mirroring database in as primary database.

In case of failover you have to specify the secondary database name, it's not failover automatically.


May 31, 2009

Microsoft BING is Releasing on 3 June 09

Microsoft BING is coming its way on 3rd June, so keep watching the new search engine wars among google & bing.
So what Microsoft say about Bing " Its will be great tool for strategic search, its search intelligently. Every seconds there are 4 new sites are being listing, current search engines are not taking these sites, but BING do."
Currently the search engines percentage worldwide is Live 3% , Yahoo 16% and Google 81% ......
So lets watch going to happen..

You can get more information about bing here 

Previously also there were search engines launched but not get popular.
Some of the search engine you can see
getit.in  [targeted for india market for searching products/services]

Mar 8, 2009

.Net Interview Questions | Assembly - Part -3

11. Do you know BCL?
The BCL (Base Class Library) is a combination of classes or we can say that it’s a library of functionalities and types available to all languages that used in .NET Framework. To make the programmer job more easier dot net gave a advantage to includes the BCL in order to collect a large number of common functions, just like to read a file and write to file, graphic rendering, database interaction, and XML document manipulation at one place . The scope of this is large and standard libraries for most other languages, including C++, and would be comparable in scope to the standard libraries is just like Java. The BCL is sometimes incorrectly referred to as the Framework Class Library (FCL), which is a superset including the Microsoft namespaces.

12. In Assembly which work as GacBrowser ?
The GACPicker class allows the user to select an assembly from the Global Assembly Cache. It does this by looking at the filesystem representation of the GAC, since there appears to be no actual API in the current .NET environment.


.Net Interview Questions | [Assembly]

.Net Interview Questions | Assembly - Part -2

6. How strong name being defined? OR What is strong name?
A strong name consists of the assembly's identity—its simple text name, version number, and culture information (if provided)—plus a public key and a digital signature. It is generated from an assembly file (the file that contains the assembly manifest, which in turn contains the names and hashes of all the files that make up the assembly), using the corresponding private key. There are SDK tools to sign an assembly with strong name. Assemblies with the same strong name are expected to be identical.

7. How to Sign an Assembly with strong Name?
The Windows Software Development Kit (SDK) provides several ways to sign an assembly with a strong name:
• Using the Assembly Linker(Al.exe) provided by the Windows SDK.
• Using assembly attributes to insert the strong name information in your code. You can use either the AssemblyKeyFileAttribute or the AssemblyKeyNameAttribute, depending on where the key file to be used is ocated.
Note: In the .NET Framework version 2.0, some compilers issue warning messages when attributes are used.
To create and sign an assembly with a strong name using the Assembly Linker
At the command prompt, type the following command:
al /out: /keyfile:
In this command, assembly name is the name of the assembly to sign with a strong name, module name is the name of the code module used to create the assembly, and file name is the name of the container or file that contains the key pair.
The following example signs the assembly MyAssembly.dll with a strong name using the key file sgKey.snk.
al /out:MyAssembly.dll MyModule.netmodule /keyfile:sgKey.snk

To sign an assembly with a strong name using attributes
In a code module, add the AssemblyKeyFileAttribute or the AssemblyKeyNameAttribute, specifying the name of the file or container that contains the key pair to use when signing the assembly with a strong name.
The following code example uses the AssemblyKeyFileAttribute with a key file called sgKey.snk, located in the directory where the assembly is compiled. This assumes that the assembly is compiled using the command-line compilers vbc.exe and csc.exe.
Visual Basic

C#
[assembly:AssemblyKeyFileAttribute(@"sgKey.snk")]


8. What is delay signing?
When signing an assembly, you might not always have access to a private key. For example, an organization might have a closely guarded key pair that developers do not have access to on a daily basis. While the public key might be available, access to the private key is restricted to a few individuals. In such a case, you can use delayed or partial signing to provide the public key, deferring the addition of the private key until the assembly is handed off.
Delay signing can be enabled in the Signing pane of the Project Designer as follows.
To delay sign an assembly
• With the project node selected in Solution Explorer, from the Project menu, click Properties (or right-click the project node in Solution Explorer, and click Properties).
• In the Project Designer, click the Signing tab.
• Select the Sign the assembly check box.
• Specify a key file. (ie key.snk)
• Select the Delay sign only check box. Note that a delay signed project will not run and cannot be debugged. You can, however, use the Strong Name Tool (Sn.exe) with the -Vr option to skip verification during development.

9. What is version number and Culture into Manifest?
Version number:- A major and minor version number, and a revision and build number. The common language runtime uses these numbers to enforce version policy.For example ... - 1.02.0012.0113
Culture:- This relates to Satellite assembly. This information should be used only to Pick an assembly as a satellite assembly containing culture- or language-specific information.

10. What do you mean by satellite assemblies?
The assemblies which contains only culture information are known as satellite assemblies.This assembly is used to get language specific resources for an application.
To know how to create satellite assmblies refer to http://msdn.microsoft.com/en-us/library/21a15yht(VS.71).aspx

.Net Interview Questions | [Assembly]

.Net Interview Questions | Assembly - Part -1

1. What you mean by Assembly?
Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. All the .NET assemblies contain the definition of types, versioning information for the type, meta-data, and manifest.

2. What is menifest?

Detailed description of the assembly contents. A manifest contains metadata describing the name, resources, types, and version of the assembly as well as dependencies upon other assemblies. The manifest makes an assembly self-describing, easier to deploy, and not bound to a particular system because of storing data in the Windows registry.

3. How many type of assembly are there?
There are two types of Assembly in .NET
• Private Assembly
• Shared Assembly
Private Assembly: These are simple assemblies and being copied with each applications running folder.Dont nned to have strong name.
Shared Assembly: Also named as Strong Named Assemblies are copied to a single location (usually the Global assembly cache). For all calling assemblies within the same application, the same copy of the shared assembly is used from its original location. Hence, shared assemblies are not copied in the private folders of each calling assembly. Each shared assembly has a four part name including its face name, version, public key token and culture information. The public key token and version information makes it almost impossible for two different assemblies with the same name or for two similar assemblies with different version to mix with each other.
An assembly can be a single file or it may consist of the multiple files. In case of multi-file, there is one master module containing the manifest while other assemblies exist as non-manifest modules. A module in .NET is a sub part of a multi-file .NET assembly. Assembly is one of the most interesting and extremely useful areas of .NET architecture along with reflections and attributes.

4. What is GAC? WhereGAC located on machine?
GAC is known as Global Assembly Cache where the shared assembiles are being kept. GAC can be found on a system at \\Assembly ie. C:\Windows\Assembly

5. Can we have two DLL with same name into GAC?
GAC is a Folder that contains DLL that have strong name.We can say that GAC is a very special folder, and it is not possible to place two files with the same name into a Windows folder,But GAC differentiates DLL by strong names and since strong name can not be same hence wwe can put two DLL with same name into GAC. For example SameNameApp.dll and SameNameApp.dll to co-exist in GAC if the first one have version 1.0.0.0 and the second have 1.1.0.0.

.Net Interview Questions | [Assembly]

SQL - Difference between CAST,CONVERT and PARSE

TODO---