Tutorial by Examples: n

SELECT @@VERSION Returns the version of MS SQL Server running on the instance. SELECT @@SERVERNAME Returns the name of the MS SQL Server instance. SELECT @@SERVICENAME Returns the name of the Windows service MS SQL Server is running as. SELECT serverproperty('ComputerNamePhysicalNetBIOS'...
Whenever you change data, in a Data Manipulation Language(DML) command, you can wrap your changes in a transaction. DML includes UPDATE, TRUNCATE, INSERT and DELETE. One of the ways that you can make sure that you're changing the right data would be to use a transaction. DML changes will take a loc...
To create a view with an index, the view must be created using the WITH SCHEMABINDING keywords: CREATE VIEW view_EmployeeInfo WITH SCHEMABINDING AS SELECT EmployeeID, FirstName, LastName, HireDate FROM [dbo].Employee GO Any clustered or non-clustered ...
One might want to GROUP BY more than one column declare @temp table(age int, name varchar(15)) insert into @temp select 18, 'matt' union all select 21, 'matt' union all select 21, 'matt' union all select 18, 'luke' union all select 18, 'luke' union all select 21, 'luke' union all select 1...
-- Identity primary key - unique arbitrary increment number create table person ( id int identity(1,1) primary key not null, firstName varchar(100) not null, lastName varchar(100) not null, dob DateTime not null, ssn varchar(9) not null )
-- natural primary key - using an existing piece of data within the table that uniquely identifies the record create table person ( firstName varchar(100) not null, lastName varchar(100) not null, dob DateTime not null, ssn varchar(9) primary key not null )
ALTER TABLE person ADD CONSTRAINT pk_PersonSSN PRIMARY KEY (ssn) Note, if the primary key column (in this case ssn) has more than one row with the same candidate key, the above statement will fail, as primary key values must be unique.
You can use limit to tell the number of records to be fetched, and use offset to tell the number of records to skip before starting to return the records. For Example User.limit(3) #returns first three records It will generate following sql query. "SELECT `users`.* FROM `users` LIMIT 3&q...
In the absence of explicit initialization, external and static variables are guaranteed to be initialized to zero; automatic variables (including register variables) have indeterminate1 (i.e., garbage) initial values. Scalar variables may be initialized when they are defined by following the name w...
The simplest way is to use the Activator class. However, even though Activator performance have been improved since .NET 3.5, using Activator.CreateInstance() is bad option sometimes, due to (relatively) low performance: Test 1, Test 2, Test 3... With Activator class Type type = typeof(BigInteg...
AppDomain.UnhandledException This event provides notification of uncaught exceptions.It allows the application to log information about the exception before the system default handler reports the exception to the user and terminates the application.If sufficient information about the state of the a...
The WebJobs Dashboard shows logs in two places: the page for the WebJob, and the page for a particular WebJob invocation. Output from Console methods that you call in a function or in the Main() method appears in the Dashboard page for the WebJob, not in the page for a particular method invocation....
There are several to evaluate a certain expression when debugging a Java application. 1. Manually inspecting an expression When the program execution is suspended at a certain line (either due to a breakpoint or manually stepping through the debugger), you can manually evaluate an expression by se...
n order to debug a remote Java application, it should be launched with some extra arguments to instruct the JVM to execute it in debug mode. This is done as follows: java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -jar sampleApp.jar The above command tells the JVM to s...
AssemblyConfiguration: The AssemblyConfiguration attribute must have the configuration that was used to build the assembly. Use conditional compilation to properly include different assembly configurations. Use the block similar to the example below. Add as many different configurations as you com...
The using keyword ensures that the resource defined within the statement only exists within the scope of the statement itself. Any resources defined within the statement must implement the IDisposable interface. These are incredibly important when dealing with any connections that implement the IDi...
To do this you need a reference to the assembly which contains the type. If you have another type available which you know is in the same assembly as the one you want you can do this: typeof(KnownType).Assembly.GetType(typeName); where typeName is the name of the type you are looking for (incl...
Problem: You need to match text of a certain format, for example: 1-a-0 6/p/0 4 g 0 That's a digit, a separator (one of -, /, or a space), a letter, the same separator, and a zero. Naïve solution: Adapting the regex from the Basics example, you come up with this regex: [0-9]([-/ ])[a-z]\...
In addition to break, there is also the keyword continue. Instead of breaking completely the loop, it will simply skip the current iteration. It could be useful if you don't want some code to be executed if a particular value is set. Here's a simple example: for (int i = 1; i <= 10; i++) { ...
Extension methods can be used to "hide" processing of inelegant business rules that would otherwise require cluttering up a calling function with if/then statements. This is similar to and analogous to handling nulls with extension methods. For example, public static class CakeExtensions ...

Page 502 of 1088