Posts

Learn useful command prompt commands for Beginners

Image
command prompt Beginner Tricks   Every beginner programmer need to learn  command prompt tricks . it will helps you to upgrade and install new packages and access files easily. Open command prompt in your system. as soon as open your prompt  looks like this. once open  your in default directory  C:\Users\CSC>  first learn how to access drive Or Jump to drives for example i am in " C Drive " i want to jump " E Drive " how to do that How to Access Drive?   Jump  " C Drive" to   " E Drive " how to do that   Type E: and hit Enter button  then the prompt looks like this  Now i want to see what are the Folders and files in " E: Drive ". how to do that type Dir   and hit Enter it will list all the Folders and files in E Drive.  in the above list how to find which is folder and which is file     Which one have <DIR> i...

How to Clean unwanted symbols in a Number column In SQL server ?

Image
. How to clean a phone Number In SQL Server ?       I have a table like this. In this table i want to display phone number without (.) symbol. for this we suppose to create a function. Table info: CREATE A USER DEFINED FUNCTION :-  USE BELLOW CODE TO CREATE A FUNCTION IN SQL SERVER(SSMS) create   function  Udf_getNumber   (  @String  Nvarchar ( 200 )) Returns   nvarchar ( 200 ) As Begin Declare  @intalpha  int set  @intalpha  =   PATINDEX ( '%[^0-9]%' , @String ) Begin   while  @intalpha  > 0 Begin set   @String  = STUFF ( @String , @intalpha , 1 , '' ) set  @intalpha  = PATINDEX ( '%[^0-9]%' , @String ) end end Return   isnull ( @String , 0 ) end once create the function use this function to get desired output  note:- use function Fully Qualified name (schema name. function name eg  dbo . Udf_getNumber ...

How to get only numbers in a column in SQL server? using ISNUMERIC function ?

Image
Q  How to get only numbers in a column in SQL server ?  Let me explain problem.      I have a table like this in this table the column(Pin No) have invalid data when i write a query i want only correct pin number rows how to do that. i will use  ISNUMERIC  function to achieve this result . ID User_name Pin no 1 Todd 517408 2 sara Pin no 3 Mark pin 516 4 Kera 506789 create a table in sql server:- create   table  user   ( id  int   , User_Name  varchar ( 20 ),  pinno  varchar ( 7 )) Go insert   into   user   values  ( 1  , 'Todd' ,   '517408' ) insert   into   user   values  ( 2 ,   'sara' ,   'Pin no' ) insert   into   user   values  ( 3 ,   'Mark' ,   'pin 516' ) insert   into   user   values  ( 4 ,   'Kera' ,   '506789' ) write a query to get only correct pin num...

Some of the SQL server General concepts?

Image
1.How to get all tables in a database particular database ? use  Finance Go select   *   from   INFORMATION_SCHEMA . TABLES 2.How to get all Column in a database particular database ? use  Finance Go select   *   from   INFORMATION_SCHEMA . columns 3.How to get all views in a database particular database ? use  Finance Go select   *   from   INFORMATION_SCHEMA . VIEW_TABLE_USAGE 4.list all the databases in SQL server  ? exec   sp_MSforeachdb   '   use [?] select DB_NAME()' 5.How to get  SQL Server edition ? select   @@VERSION 6.How to Rename a Tabl e in SQL Server ? Using system store procedure   Sp_Rename Use  Test Go Exec   sp_rename    Old_table name  ,   New_tablename using  Sp_Rename   to rename all the sql server Objects  like  1. Table name       2. S...