Posts

Get Random alphanumeric number with specific length using SQL Server

Create a function to get the new guid

create view [dbo].[MyNewGuid] as
select newid() as NewID;

Call below user defined function and pass the number of characters to be returned.

CREATE FUNCTION [dbo].[ufn_RandomString](
    @pStringLength int = 10 -- No of characters to be returned
    ,@isupper bit=0 -- will be returned in upper case or lowercase
) returns varchar(max)
as begin
    declare  @RandomStr varchar(max);
    with
    a1 as (select 1 as N union all
           select 1 union all
           select 1 union all
           select 1 union all
           select 1 union all
           select 1 union all
           select 1 union all
           select 1 union all
           select 1 union all
           select 1),
    a2 as (select
                1 as N
           from
                a1 as a
                cross join a1 as b),
    a3 as (select
                1 as N
           from
                a2 as a
                cross join a2 as b),
    a4 as (select
                1 as N
           from
           …

Finding nearby longitude and latitude within specific distance in database

 To get near by cities which are having longitude and latitude within specific distance in database

SELECT * FROM
(
SELECT * FROM
(
SELECT *,(((acos(sin((@latitude*pi()/180)) * sin((Latitude*pi()/180))+cos((@latitude*pi()/180))
 * cos((Latitude*pi()/180)) * cos(((@longitude - Longitude)*pi()/180))))*180/pi())*60*1.1515*1.609344) as distance
 FROM tblCities
) t
)x where distance <= 1000
ORDER by distance

List of special Characters in HTML

List of special Characters in HTML

left single quote&lsquo;right single quote&rsquo;single low-9 quote&sbquo;left double quote&ldquo;right double quote&rdquo;double low-9 quote&bdquo;dagger&dagger;double dagger&Dagger;per mill sign&permil;single left-pointing angle quote&lsaquo;single right-pointing angle quote&rsaquo;black spade suit&spades;black club suit&clubs;black heart suit&hearts;black diamond suit&diams;overline, = spacing overscore&oline;leftward arrow&larr;upward arrow&uarr;rightward arrow&rarr;downward arrow