SQL – Char vs. Varchar

Memory allocation is static for char data type variables but in case of varchar memory allocation is dynamic. This is the basic difference between char and varchar. Example create table test1 ( name1 char(10), name2 varchar(10) ); Insert into test1 values ('Varinder','Varinder'); select * from test1; I hope this will help.

» Read more

SQL Server 2008 – Object Explorer Details and SQL Server Object Search

My one friend calls me and asks where I find the Object detail in SQL Server 2008. This is very simple but may be some people are in the same situation and finding the Object Explorer Details in SQL Server 2008. That‘s why here sharing Object Explorer Details and SQL Server Object Search. SQL Server Object Search is useful for developer to find the some specific object in the database or across SQL Instance. Object Explorer Details, a component of

» Read more

SQL Server code name ‘Denali’ – Community Technology Preview 3 (CTP 3)

Microsoft SQL Server code name ‘Denali’ enables a cloud-ready information platform that will help organizations unlock breakthrough insights across the organization as well as quickly build solutions and extend data across on-premises and public cloud backed by capabilities for mission critical confidence. SQL Server code name ‘Denali’ enables a cloud-ready information platform that will help organizations unlock breakthrough insights across the organization as well as quickly build solutions and extend data across on-premises and public cloud backed by capabilities for

» Read more

SQL Serevr Replication – Setup and configure Subscription on SQL 2008R2 – Part 4 of 4

New Subscription wizard as below Select the publication and then press “Next” Next you have choose the subscriber and subscription database Here we are choosing the Push subscription Select Push subscription (First one) then press “Next” Select Agent Schedule “Run Continuously” the press “Next” Select Initialize when as “At first Synchronization” Select option “Create the subscription” Wait for the subscription process to finish. Finally subscriber has been created. Reference URL http://www.varindersandhu.in/2011/08/12/sql-server-how-to-setup-sql-server-replication/

» Read more

SQL Serever Replication – Setup and configure the Publication on SQL Server 2000 – Part 3 of 4

In part 2, we have configured a SQL Server as a main publishing server, we have to create a publication of databases which the clients can subscribe. Click on New Publication “Create Publication Wizard” starts, check the “Show advanced options in this Wizard” checkbox and press “Next” After please select your database and press “Next” In the “Select Publication Type” screen select “Transactional publication” (second option) en press “Next” On the “Specify Articles” Screen check all the checkboxes on the

» Read more

SQL Server Replication – Setup and configure a SQL Server 2000 as a main Publisher/Distributor – Part 2 of 4

Click on the Configuring Publishing, subscribes and Distribution option then the Configuring Publishing and Distribution Wizard starts up. Specify the UNC (Universal Naming Convention) path Select “No”- accepting default settings – and press next. Successfully enabled…” message should appear. Notification that a “replication object” has been added to the console tree for this server in SQL Server Enterprise Manager Close this screen and the following SQL Server properties screen. Now you can see the Publisher in SQL Server Enterprise Manager

» Read more

SQL Server Replication – Configure the SQL Server Agent – Part 1 of 4

Once you are going setup SQL Server Replication configures the SQL Server Agent as: Make Sure SQL Server Agent is running Right click My Computer -> Manage… -> Choose from the tree at the left: “Services and Applications” -> “Services” By default the SQL Server Agent runs under the local System account, but for SQL Server Replication to work this must be changed to a specific created user account that has all the necessary rights to run as a service.

» Read more

SQL Server – How to Setup SQL Server Replication – Part 0 of 4

Introduction This document describes a scenario how to setup the Transactional SQL Server Replication. Before we proceed for Replication setup you can read brief note about “Understanding of Replication” http://www.varindersandhu.in/2011/05/14/understanding-of-replication/ Here we will setup the Transactional SQL Server Replication between SQL Server 2000 and SQL Server 2008R2. Pre-requisite SQL Server 2000 SQL Server 2008R2 This document describes below points Configure the SQL Server Agent Setup and configure a SQL Server 2000 as a main Publisher/Distributor Setup and configure the Publication

» Read more

SQL Server – Location of Installation Log file

A few times we were trying to locate the installation log file folder if we faced any issue or problem while installation of SQL Server. Basically, we want to know reason of issue or problem. So location of Log file folder as below SQL Server 2008 and 2008 R2 %programfiles%\Microsoft SQL Server\100\Setup Bootstrap\Log\ SQL Server 2005 %ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\LOG\ You can find the Summary.txt file in above mentioned location. This file shows the SQL Server components that were detected during

» Read more

SQL Server – Error Handling Using TRY…CATCH

Prior to SQL server 2005, the only way of performing the error handling was to test vale of @@ERROR global variable. Once the SQL Server completes the execution of a Transact-SQL statement, it records the status of result in @@ERROR. If the error occurred, @@ERROR contains the error number. If the statement executed successfully it contain the 0. You need to check the variable if the statement succeeded or failed. Using @@ERROR to perform the error handling is not easy

» Read more

Restore SQL 2008 full database backup to SQL Server 2005

My friend wants to restore the SQL 2008 full backup to SQL Server 2005. He faced an issue while restore the SQL 2008 full backup to SQL Server 2005. He has a question from me as: Can we restore the SQL 2008 full database backup to SQL Server 2005? Answer: No, we can’t restore a backup from a higher version of SQL Server on a lower version of SQL Server. Alternative: If you are not using any features specific to

» Read more

SQL Server – Get Comma Separated Values from table

I had requirement to get the Comma Separated Values from the table for specific column. So here sharing with you example how i handle this situation. USE tempdb GO CREATE TABLE test1 ( column1 INT, column2 VARCHAR(6) ) INSERT INTO test1 VALUES (1,'Test1'), (1,'Test2'), (2,'Test3'), (2,'Test4'), (3,'Test5') Now see the table SELECT * FROM TEST1  Create a function to get the Comma Separated Values as below CREATE FUNCTION dbo.CommaSeparatedvalues ( @parameter1 AS INT ) RETURNS VARCHAR(5000) AS BEGIN DECLARE @CSV

» Read more
1 2 3 4