Useful MSSQL Queries and Statements

Although I primarily use MySQL on linux servers, I’ve had a couple clients using MSSQL databases for all sorts of things from email marketing to order tracking. For these clients, I use Microsoft SQL Sever Management Studio Express and have saved many of the MSSQL queries I’ve had to create. Some of these will work fine in MySQL as is or with minimal tweaking.

Here’s a collection of the useful MSSQL Queries I’ve used and saved. This is by no means a comprehensive list of all the MSQL Queries and MSSQL statements, but I hope they can be useful for you.

MSSQL Variables

Being able to declare MSSQL Variables has saved so much time for sets queries that I need to run multiple times with slight variations.

This is a very basic example, but has everything you need. MSSQL Variables must begin with a “at symbol” (@). You first declare the MSSQL variables and assign it a character type (in this case, I’m just using varchar(55). 55 is the maximum number of characters to be stored in the variable. Then you set a value for the variables.

Declare @email1 varchar(55), @name1 varchar(55)
set @email1 = ‘%websitesinaflash.com%’
set @name1 = ‘%Ashton Sanders%’

SELECT *
FROMÂ Â email_database
WHERE email_address LIKE @email1
AND first_name LIKE @name1

MSSQL UNION

ActionScript Basics – Structure

My Last Post discussed ActionScript Variables. Now I’m going to do a quick run down about ActionScript Structure.

You will notice that many different programming languages have a similar format. PHP and ActionScript, for example, have a very similar syntax. A lot of functions are written exactly the same for both of them. There is one very unique thing about ActionScript: Symbols can be inside Symbols inside Symbols inside Symbols. (A symbol is either a Graphic, Movie Clip or Button. F8 will turn the selected items into a symbol of your choice.)

This structure is very useful for animating in Flash (and a lot more). You can also store variables within movie clips. Lets say you had a movie clip called “ball”.

//This is programmed onto the first frame of your movie.

x = 3;
ball.x = 4;

That code will store two different variables. Even though the variables have the same name, they are located in different places, so the second variable wouldn’t overwrite the first one.

-Yes, this is very basic.
-Ashton Sanders

ActionScript Basics – Variables

This post is about variables in AcrionScript (the programming language for Macromedia/Adobe Flash).

ActionScript Basics

Some very quick basics

// <- These two slashes are a comment.
// Everything after a comment on that line
// will not be processed by Flash

every.statement.ends.with.a.semicolon;

Varbiable Basics

What is a variable? A variable is group of numbers and letters or one letter that will store an amount, a string or a true/false statement. A variable cannot start with a number.

// This Creates the variable “x” and
// gives it the numeric value of 4
x = 4;

// trace() will display whatever you put
// between the “(” and “)”.
trace(x);

// That will display: 4

In this example, the numeric value of “4” was stored in the variable “x”. Here is another example:

number = “4”;

trace(number);
// 4

These last two examples were very similar, but notice that the variable (number) was given the value of “4” (with quotes around it). The quotes changed the value of the variable from a numeric value to a string. A string is just a group of number, letters, symbols, etc. defined with quotes.

statement = “Here’s a statement for you”;

trace(statement);
// Here’s a statement for you

As I mentioned above, you can give a variable a numeric, string or true/false value. This third value type is called a Boolean value. A boolean value is either yes/no, true/false, 1/0, on/off, etc. In Action Script, you can assign them with either true/false or 1/0.

go = true;

trace(go);
// true

That is a quick summary of how to declare variables the shorthand way in ActionScript. My next posts will be along these same lines, so if you are hungry for more, check out my other ActionScript Posts them out.

If you have any questions, or if I was unclear at any part, feel free to leave a comment, and I’ll get it fixed up for you.

-Until Then,
-Ashton Sanders