SQL SERVER – Using PowerShell and Native Client to run queries in SQL Server

Many time I heard about Powershell , but never go thorogh it. I tried it at basic level to connect to sql server from SQL Native Client. Coding looks similar to web developers  (like some properties as  'ExecuteScalar' ,'ExecuteNonQuery' ).
Its very interesting which comes with SSMS (SQL Server Management Studio) .
I already have sample database created on my local , which I would like to connect through powershell.
/*Create table and keep some records for fetching from SQL Query*/
CREATE TABLE [dbo].[tbl_Employee](
 [ID] [int] IDENTITY(1,1) NOT NULL,
 [FirstName] [varchar](max) NULL,
 [LastName] [varchar](max) NULL,
 [Address] [varchar](max) NULL)

 









"1" indicates record inserted successfully !!
   PowerShell very useful any kind of deployment on remote servers  .
  Share your comments with addition information .

Hope u will try it . You might get few error , but its interesting.





Comments

Popular posts from this blog

Add Serial no in crystal report without coding

File operations in C# (.net)

SQL – Generate decimal numbers sequence for particular number range