Feb 20, 2011

How to pass variable to sql script from batch file?


How to pass variable to sql script from batch file?
1.       Create a Table called Employees
id int
fname varchar(50)
lname varchar(50)
dept varchar(10)

2.       Insert few records into it as
Id            fname                   lname                   dept
01           Mohd                    Irfan                      IT
02           Gaurav                  Thakur                  IT
03           Animesh              Mishra                  Security
04           Ashok                   Roy                        Admin
3.       Create the sql script as getEmployees.sql
use $(dbname)
select * from $(tablename)

4.       Create the runsqlscript.bat file for running the sql script as below.
sqlcmd -S %1 -i getEmployees.sql -v dbname = %2 tablename = %3 -o %4

5.       Run this command from cmd.
>runsqlscript.bat SQLServerName DBName Employees D:\EmployeesList.txt


Sep 2, 2010

HCL Care Noida

Hcltouch Number for Noida - 18601800425
For Desktop - Monday to Saturday 9:00 AM to 5:00 PM
For Labtop - 24x7
 

Mar 18, 2010

Equivalent SQLWB Command in SLQ 2008

Run command for opening SQL2005 management studio is SQLWB, however the same is not availabl ein sql 2008.
So what is the run command for SQL 2008
 
 
Its SMSS
 
Go to Start -> RUN
Type SSMS
Click Enter
 
And here you are with SQL2008 Management Studio.
 
 

Jan 22, 2010

It is possible to have dynamic query in LINQ?

It is possible to have dynamic query in LINQ?

var data = items in ItemsList
where items='some condition'
select items;


The above query is static query as its already written and it will be executed good.

I wanna know if we can make the same query into some string and exec the same??

Jan 18, 2010

Can SQL Mirroring be implemented on .NET 1.1

The straight answer is NO, let me find some tweeks and update this topic.

And yes its true, for mirroring , failover implementation it need to provide the failover partner into the connection string which is not supported for .NET Framework 1.1 and 1.0.


http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx


Key: Failover Partner
Default Value : N/A
Description: The name of the failover partner server where database mirroring is configured.
The Failover Partner keyword is not supported by .NET Framework version 1.0 or 1.1.

Jan 15, 2010

Database Mirroring Vs Database Replication [SQL 2005 and Above]


Database Mirroring

Database Replication

Making the same database with transaction logs [ synchronous or asynchronous]

Making the same database replicated on other server.

Only snapshot can be used to fetch the data from mirroring server.

Can be fetched data directly from the replicated server.

Mirroring is preferred when we want database online most of the time.

Replication used when we need to run the reports without affecting the primary database performance.

In case of failover the mirroring database in as primary database.

In case of failover you have to specify the secondary database name, it's not failover automatically.


May 31, 2009

Microsoft BING is Releasing on 3 June 09

Microsoft BING is coming its way on 3rd June, so keep watching the new search engine wars among google & bing.
So what Microsoft say about Bing " Its will be great tool for strategic search, its search intelligently. Every seconds there are 4 new sites are being listing, current search engines are not taking these sites, but BING do."
Currently the search engines percentage worldwide is Live 3% , Yahoo 16% and Google 81% ......
So lets watch going to happen..

You can get more information about bing here 

Previously also there were search engines launched but not get popular.
Some of the search engine you can see
getit.in  [targeted for india market for searching products/services]

SQL - Difference between CAST,CONVERT and PARSE

TODO---