|
|
-
|
|
This follows my part I at http://beyondrelational.com/blogs/madhivanan/archive/2011/05/03/sql-server-s-equivalent-of-oracle-functions-part-i.aspx
ORACLE SQL Server
Decompose Cast or Convert (Ex cast(string as nvarchar(8000))
numtodsinterval select datename(dayofyear,DATE)-1,CONVERT(varchar(......
|
|
-
|
|
Often you may need to know what are the SQL Server's equivalent of ORACLE's function when you migrate your Database from ORACLE to Server.In this series of post, I will show you the SQL Server's equivalent of ORACLE functions.
ORACLE SQL Server
Decompose Cast or Convert (Ex cast(string as nvar......
|
|
-
|
|
You can change the datatype of the column with ALTER statement. You may think that it will never change the column values. But there are some cases where altering a datatype can cause changing the value of the column. Consider the following table
create table test(id int, dates varchar(100))
in......
|
|
-
|
|
SQL Server currently supports 37 different datatypes. But Many people may not know that there are some datatypes in SQL Server which are considered as Special datatypes. They are listed below
bit hierarchyid sql_variant sysname table timestamp Alias data types
They are knwon as special datatypes......
|
|
-
|
|
Sometimes you may be on need of knowing what the backup type of the backup file is. For example the backup file may be of full backup, transaction log, diffential database etc. If you want to know it before restoring a database you can use RESTORE HEADERONLY option
Assume that you have a backup fi......
|
|
-
|
|
One of the members in the SQL Server forum asked a question about querying the remote server without actually adding it as a Linked Server. One of the options to do this is to make use of the OPENDATASOURCE function
Assume that you have two servers Server1 and Server2. You want to query a table fro......
|
|
-
|
|
Alias name can be used in such cases like more than a table is used in the select statement, naming a derived column or table, etc. However the usage seems to be different among the RDBMSs. Consider the following examples which are valid in SQL Server
select t.* from table1 as t
select sum(t.a......
|
|
-
|
|
When I was viewing someone's code, I have noticed that the date values were not
compared as dates but they were converted to varchar before comparision
Suppose, you want find out the objects that were created in February 2011. The correct
code is
select
name
from
......
|
|
-
|
|
One of my frieds told me that INSERT trigger will not fire if no data are added to the main table. It is a mistake that some people think that triggers will not fire if no row is affected. Note that trigger is event based and not data based.
Here is a proof that trigger fires eventhough no row is ......
|
|
-
|
|
One one my friends asked mw if it is possible to copy the directory structure information with size to a text file. This can be done via any front end application. If you want to do this from SQL Server you can make use of system procedure xp_cmdshell
Consider the follwoing code
DECLARE @cmd sys......
|
|