July 16 2010 by
Ryan Carter in
SQL |
There is no pause in there, “LIKE!…searches!” This is a no teeny-bopper zone (unless you want to program stuff, then by all means)! When you know only part of what you’re looking for in a SQL SELECT statement, especially for AJAX auto-complete queries, you will need to employ the all-consuming power of the “LIKE Search” [...]
July 15 2010 by
Ryan Carter in
SQL |
The local variables here can be ones you send to your stored procedure, local variables, whatever. The first set of parenthesisW “()” contains the list of fields you want to put data in, like telling someone to stuff a flyer in certain mailboxes (except for that being illegal). The second list is the values or [...]
July 15 2010 by
Ryan Carter in
SQL |
DECLARE @var1 VARCHAR(50) SET @var1 = ‘hello’ Then you can use it in your SELECT (and other) statements later, like this: SELECT * FROM tablename WHERE welcomemessage = @var1
July 15 2010 by
Ryan Carter in
SQL |
To repeat a block of code in SQL until a certain condition is reached, you can use a WHILE loop, like this: –DECLARE your vars first DECLARE @var1 INT DECLARE @var2 INT –the WHILE itself WHILE @var1 > 10 BEGIN @var2 = @var2 + @var1 IF @var2 > 10 BREAK END The IF block [...]
July 15 2010 by
Ryan Carter in
SQL |
CREATE PROCEDURE procedureName @var1 INT, @var2 VARCHAR(255) AS BEGIN SELECT * FROM tablename WHERE fieldname = @var1 END
July 15 2010 by
Ryan Carter in
SQL |
CREATE TABLE #tablename( id INT )