Sql
Saturday, February 16th, 2008
SQL Injection is a term for injecting SQL command or query in the address query or as a input in the form of the POST or GET method in the web pages.
For example:
You have a database of different products, with primary key product_id. To get a product info from database, ...
Posted in PHP, Security, Sql | No Comments »
Tuesday, January 29th, 2008
Microsoft SQL Server allows to return the results of a query in XML format.
Let's create a simple table:
create table test
(
field_a varchar(20),
field_b varchar(20)
);
insert into test values('Microsoft','SQL Server');
insert into test values('Oracle','Oracle Database');
SQL to XML transformation is very simple to use. It's done by adding following clause at the end of a query:
FOR ...
Posted in Ms Sql Server, Sql, Xml | No Comments »
Thursday, January 10th, 2008
When first testing a database, nothing is more useful than iSql, and to be able to display and modify your data quickly and simply. This software is given with almost all sql databases and is used to execute queries.
In this article we will see how to build our own iSql ...
Posted in Asp, Sql | No Comments »
Wednesday, August 29th, 2007
Oracle Synonyms can be easily simulated in SQL Server by using Views.
The following example creates a view that returns the CarID and CarPurchaseDate from Cars table.
CREATE VIEW vCars
AS
SELECT CarID, CarPurchaseDate
FROM Cars
SELECT statement:
SELECT * FROM vCars
Let's create a view which is Sql Server version of Oracle's TABS synonym or USER_TABLES data ...
Posted in Ms Sql Server, Oracle, Sql | No Comments »
Monday, August 20th, 2007
Returns number of days, months, weeks, hours, minutes etc. between two dates.
Syntax: DATEDIFF(datepart_code, startdate, enddate);
Date Part | Code
--------------------------------
Year | yy, yyyy
Quarter | qq, q
Month | mm, m
Day of year | dy, y
Day | dd, d
Week | wk, ww
Hour | hh
Minute | mi, n
Second | ss, s
Millisecond | ms
Posted in Ms Sql Server, Sql | No Comments »
Monday, August 20th, 2007
Decode function in Oracle:
decode (expression, search_1, result_1, search_2, result_2, ...., search_n, result_n);
decode (expression, search_1, result_1, search_2, result_2, ...., search_n, result_n, default);
For example:
create table example (x int, y int);
insert into example values (1,2);
insert into example values (1,3);
insert into example values (2,4);
insert into example values (2,5);
insert into example values (3,6);
Following query:
select * ...
Posted in Oracle, Sql | No Comments »