Created
November 22, 2016 05:08
-
-
Save artur-kink/74dd723e8a4c029f728d28f293505b30 to your computer and use it in GitHub Desktop.
Doxygen sql codeblock test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @file sql.c sql queries | |
*/ | |
/*! | |
* @page sqltest SQL code test | |
* | |
* ~~~~~~~{.sql} | |
* CREATE PROCEDURE GetUser | |
* @LastName nvarchar(50), | |
* @FirstName nvarchar(50) | |
* AS | |
* SELECT FirstName, LastName | |
* FROM Users | |
* WHERE FirstName = @FirstName AND LastName = @LastName | |
* ~~~~~~~ | |
* | |
* ~~~~~~~{.sql} | |
* SELECT * FROM mytable | |
* WHERE username = "1234" OR /*username = "1233"*/ OR userid = 1234 OR charcode = 'c' | |
* ORDER BY id | |
* -- Above query is a SELECT * query | |
* ~~~~~~~ | |
* | |
* ~~~~~~~{.sql} | |
* CREATE PROCEDURE ROWPERROW() | |
* BEGIN | |
* DECLARE n INT DEFAULT 0; | |
* DECLARE i INT DEFAULT 0; | |
* SELECT COUNT(*) FROM table_A INTO n; | |
* SET i=0; | |
* WHILE i<n DO | |
* INSERT INTO table_B(ID, VAL) VALUES(ID, VAL) FROM table_A LIMIT i,1; | |
* SET i = i + 1; | |
* END WHILE; | |
* END | |
* ~~~~~~~ | |
* * | |
* ~~~~~~~{.sql} | |
* -- copied this from some random msdn example | |
* DECLARE @AvgWeight decimal(8,2), @BikeCount int | |
* IF | |
* (SELECT COUNT(*) FROM Production.Product WHERE Name LIKE 'Touring-3000%' ) > 5 | |
* BEGIN | |
* SET @BikeCount = | |
* (SELECT COUNT(*) | |
* FROM Production.Product | |
* WHERE Name LIKE 'Touring-3000%'); | |
* SET @AvgWeight = | |
* (SELECT AVG(Weight) | |
* FROM Production.Product | |
* WHERE Name LIKE 'Touring-3000%'); | |
* PRINT 'There are ' + CAST(@BikeCount AS varchar(3)) + ' Touring-3000 bikes.' | |
* PRINT 'The average weight of the top 5 Touring-3000 bikes is ' + CAST(@AvgWeight AS varchar(8)) + '.'; | |
* END | |
* ELSE | |
* BEGIN | |
* SET @AvgWeight = | |
* (SELECT AVG(Weight) | |
* FROM Production.Product | |
* WHERE Name LIKE 'Touring-3000%' ); | |
* PRINT 'Average weight of the Touring-3000 bikes is ' + CAST(@AvgWeight AS varchar(8)) + '.' ; | |
* END ; | |
* GO | |
* ~~~~~~~ | |
* | |
* ~~~~~~~{.sql} | |
* -- simple comment explaining this is a create table | |
* CREATE TABLE Persons | |
* ( | |
* PersonID int, | |
* LastName varchar(255), --this is the last name | |
* FirstName varchar(255), /*This is the first name*/ | |
* Address varchar(255), -- Persons address | |
* City varchar(255) DEFAULT VALUE NULL, | |
* thingy boolean DEFAULT VALUE TRUE | |
* ); | |
* ~~~~~~~ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment