|
|
-
|
|
There is a blog post about #TSQL CAST Conversion Error… give me the row please! where the posted showed some methods to identify the data where convertion error happens. Here are other approaches to identify the problamatic data. Consider the following ...
|
|
-
|
|
Without executing this query, can you find out the output?
select _________ name from
(
select 2e4 _________
) t
...
|
|
-
|
|
Often peple ask this question in the forum. "I created a procedure with proper alignment. But when I wanted to alter the procedure, result of sp_helptext did not keep the original alignment. How do I keep the original format?"
Well. One answer is to make use of Script Stored Procedure --> ALTER TO ......
|
|
-
|
|
Table and Database designers
and uncheck......
|
|
-
|
|
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......
|
|
-
|
|
Both these functions are used to convert values from one datatype to another But there are some differences between them 1 CAST is ANSI standard and CONVERT is specific to SQL Server 2 CAST can't be used for formating purposes. But CONVERT can be used for formating purposes particularly on datetime ......
|
|
-
|
|
''
Begin
Declare @str varchar(1000)
set @str='Exec Master..xp_Cmdshell ''bcp "Select * from '+db_name()+'..'+@table_name+'"
queryout "C:\data\'+@table_name+'.txt" -c'''
Exec(......
|
|
-
|
|
Here is the script that takes backup of all databases excluding system databases
The file name would be databasename_yyyymmdd where yyyymmdd is the formatted value of current date
create procedure Backup_all_databases
as
Declare @sql varchar(8000)
set @sql=''
select @sql=@sql+
'
Backup dat......
|
|
-
|
|
It is possible to use Common Table Expression in a View.
But newbies wonder why the following is not possible
create view numbers
as
with numbers(n) as
(
select 1 as n union all select n+1 from numbers where n
Which when created results to the error
Msg 156, Level 15, State 1, Procedure......
|
|
-
|
|
When you use variables in update statement and update the columns with the values of variableswhich keep on changing for each row, you can simulate many things that are done using Loop or a Cursor
declare @temp table
(
product_name varchar(100),
Value int,
sequence int
)
insert into @temp......
|
|