Manish Pansiniya's Blog

.NET, C#, Javascript, ASP.NET and lots more…:)

Posts Tagged ‘SQL

float to string sql cast or convert

leave a comment »

If you directly use convert it gives you solution in terms of +e. But if we convert it to bigint first then it provide the correct conversion to string.

CONVERT(nvarchar,  CAST(floattoconvert as bigint))

You can use str function but you need to be careful as it appends 0 or space while converting the same. So it would be bit tricky to use str function.

Advertisements

Written by Manish

August 10, 2010 at 7:29 pm

Simple Yet Powerful SQL Server Tutorial

leave a comment »

W3Schools is known for their simple tutorial for basic things. They have SQL tutorial which is very simple yet cover all the basic functionalities.

http://www.w3schools.com/SQl/default.asp

For some detail tutorial, refer

http://www.functionx.com/sqlserver/

Written by Manish

October 29, 2009 at 6:21 pm

Posted in .NET

Tagged with ,

How to query different type database object like table, view, trigger using sysobject

with one comment

 

following is the query for selecting all object from all database

SELECT      name, id, xtype, uid, info, status, base_schema_ver,  replinfo, parent_obj, crdate, ftcatid, schema_ver,  stats_schema_ver, type, userstat, sysstat, indexdel,  refdate,version, deltrig, instrig, updtrig, seltrig,  category, cache
FROM        sys.sysobjects

There are various parameter which you can use as where to specify criteria.

If you want to search certain object type then

XTYPE =

‘U’ For table
‘PK’ For Primary Keys
‘F’ For Foreight Keys
‘V’ For views
‘P’ For stored procedures
‘TR’ For triggers
‘S’ For system objects
‘FN’ Function

 

You can also add like query on name to give specific resultset.

Written by Manish

August 25, 2009 at 4:22 pm

Posted in .NET

Tagged with , ,