Tutorial by Examples

DELETE FROM [dbo].[Customers] WHERE CustomerName = 'Gorge'; INSERT INTO [dbo].[Customers] ([CustomerName]) VALUES ('George') SELECT * FROM [dbo].[Customers] Results CustomerIDCustomerName10001Jerry10003George
SCOPE_IDENTITY() returns the last identity value inserted into an identity column in the same scope. A scope is a module: a stored procedure, trigger, function, or batch. Therefore, two statements are in the same scope if they are in the same stored procedure, function, or batch. INSERT INTO ([col...
This function will take 2 datetime parameters, the DOB, and a date to check the age at CREATE FUNCTION [dbo].[Calc_Age] ( @DOB datetime , @calcDate datetime ) RETURNS int AS BEGIN declare @age int IF (@calcDate < @DOB ) RETURN -1 -- If a DOB is supplied a...
CREATE VIEW dbo.PersonsView AS SELECT name, address FROM persons;
This query will drop the view - if it already exists - and create a new one. IF OBJECT_ID('dbo.PersonsView', 'V') IS NOT NULL DROP VIEW dbo.PersonsView GO CREATE VIEW dbo.PersonsView AS SELECT name, address FROM persons;
Will be available till the current connection persists for the user. Automatically deleted when the user disconnects. The name should start with # (#temp) CREATE TABLE #LocalTempTable( StudentID int, StudentName varchar(50), Student...
Will start with ## (##temp). Will be deleted only if user disconnects all connections. It behaves like a permanent table. CREATE TABLE ##NewGlobalTempTable( StudentID int, StudentName varchar(50), StudentAddress varchar(150)) Insert ...
Create a Job To add a job first we have to use a stored procedure named sp_add_job USE msdb ; GO EXEC dbo.sp_add_job @job_name = N'Weekly Job' ; -- the job name Then we have to add a job step using a stored procedure named sp_add_jobStep EXEC sp_add_jobstep @job_name = N'W...
Depending on the structure of your data, you can create variables that update dynamically. DECLARE @CurrentID int = (SELECT TOP 1 ID FROM Table ORDER BY CreateDate desc) DECLARE @Year int = 2014 DECLARE @CurrentID int = (SELECT ID FROM Table WHERE Year = @Year) In most cases, you will want...
Detailed instructions on getting zend-framework set up or installed.
Example of setting the isolation level: SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SELECT * FROM Products WHERE ProductId=1; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; --return to the default one READ UNCOMMITTED - means that a query in the current transaction can't access the...
First, let's setup the example table. -- Create a table as an example CREATE TABLE SortOrder ( ID INT IDENTITY PRIMARY KEY, [Text] VARCHAR(256) ) GO -- Insert rows into the table INSERT INTO SortOrder ([Text]) SELECT ('Lorem ipsum dolor sit amet, consectetur adipiscing elit') U...
First, in addition to the normal Fresco Gradle dependency, you have to add the OkHttp 3 dependency to your build.gradle: compile "com.facebook.fresco:imagepipeline-okhttp3:1.2.0" // Or a newer version. When you initialize Fresco (usually in your custom Application implementation), you ...
Granting permission to create tables USE AdventureWorks; GRANT CREATE TABLE TO MelanieK; GO Granting SHOWPLAN permission to an application role USE AdventureWorks2012; GRANT SHOWPLAN TO AuditMonitor; GO Granting CREATE VIEW with GRANT OPTION USE AdventureWorks2012; GRANT C...
Adding dependencies into the build.gradle file. dependencies { .... compile 'com.squareup.retrofit2:retrofit:2.1.0' compile ('com.thoughtworks.xstream:xstream:1.4.7') { exclude group: 'xmlpull', module: 'xmlpull' } .... } Then create Converter Factory public c...
Create a custom BitmapImageViewTarget to load the image into: public class CircularBitmapImageViewTarget extends BitmapImageViewTarget { private Context context; private ImageView imageView; public CircularBitmapImageViewTarget(Context context, ImageView imageView) { ...
Note: This example requires a valid Admob account and valid Admob ad code. Build.gradle on app level Change to the latest version if existing: compile 'com.google.firebase:firebase-ads:10.2.1' Manifest Internet permission is required to access the ad data. Note that this permission does not h...
Strikethrough the entire text String sampleText = "This is a test strike"; textView.setPaintFlags(tv.getPaintFlags()| Paint.STRIKE_THRU_TEXT_FLAG); textView.setText(sampleText); Output: This is a test strike Strikethrough only parts of the text String sampleText = "This is a...
Implicit intents do not name a specific component, but instead declare a general action to perform, which allows a component from another app to handle it. For example, if you want to show the user a location on a map, you can use an implicit intent to request that another capable app show a specif...
To achieve the simplest task in Entity Framework - to connect to an existing database ExampleDatabase on your local instance of MSSQL you have to implement two classes only. First is the entity class, that will be mapped to our database table dbo.People. class Person { public int...

Page 741 of 1336