|
|
-
|
|
Pinal Dave in his post asked about the simple ways to convert hexadecimal values to decimal values.
Here are some methods:
87235 is an integer value whose hexadecimal is 0x000154C3.
In this case make use of Implicit conversion.
declare @hexa varbinary(10)
set @hexa=0x000154C3
select
@hex......
|
|
-
|
|
Some people suggest usage of information_schema.routines View to view the definition of the procedure The problem is the datatype of that column is nvarchar(4000) and there is a chance that the definition gets truncated. So, the following wont give you full text of the definition
select routine_......
|
|
-
|
|
My co-worker had a task of finding minimum alternate week day as of today for a given date and day. Consider these data
Date : 2009-12-22
day : 5 (it denotes Thursday)
It means the event was scheduled on 2009-12-22 which should run on every alternate Thursday starting ......
|
|
-
|
|
One of the questions asked in a forum was about replacing data of one table by the data of
another table
The solution that the questioner used was having cursor by looping through the source table and
replace particular words by other words from another table by matching the words
Here is ......
|
|
-
|
|
In the Query Analyser, set the Result mode to Text (Press CTRL+T) and run the following code
set nocount on
select
space(17-len(replicate(char(94),no)))+ replicate(char(94),no*2-1)
from
(
select top 10 row_number() over (order by name) as no from sysobjec......
|
|
-
|
|
Sometimes, you may need to find a value in the characters columns (char, varchar, etc) in all
the tables
This is one of the methods to do it
declare @sql varchar(max),@search varchar(100)
set @sql=''
set @search='your search string'
select
@sql=@sql+'select distinct ''['+c......
|
|
-
|
|
In my previous post about Removing unwanted characters , I posted a method that used a function
Here is another method that uses Dynamic SQL
declare @data table (data varchar(100))
-- table that has source data
insert @data
select 'tes^@&t %stri)-n!g' data union all
select '))aa......
|
|
-
|
|
0
begin
insert into @temp(data)
select substring(@s,1,charindex('~!@#',@s)-1)
set @s=substring(@s,charindex('~!@#',@s)+4,len(@s))
end
insert into @temp(data)
select @s
--Extract the tags
select data from @temp where id%2=0
--Extract the data available outs......
|
|
-
|
|
As you know, semicolon is used as a statement terminator in almost all RDBMSs. However the usage
of semicolon is optional in SQL Server except a few cases. Here are atleast the three cases
where usage of semicolon is a must
1 At the start of the Common Table Expression (If any statement prece......
|
|
-
|
|
One of the new features available in SQL Server 2008 is compressed backup which takes backup of
a database with mimimum possible size. The syntax is
backup database db_name to disk='backup_path'
with init, compression
But this works only in Enterprise Edition of the SQL Server 2008 and not......
|
|