Click here to Skip to main content
15,885,914 members
Everything / Database Development / SQL Server / SQL Server 2008

SQL Server 2008

SQL-Server-2008

Great Reads

by Wonde Tadesse
This tip/trick helps to set a default value for blob data type such as Image, VarBinary.
by Mubin M. Shaikh
Create time dimension with 24 hour plus values and time buckets in your data warehouse
by Harmen Brouwer
How to create and deploy a SSRS rendering extension, explained by a functional Zip Rendering extension for SSRS 2005, 2008 (R2) and 2012.
by Tecfield
This tip shows how to rename a database and its MDF and LDF files in SQL Server.

Latest Articles

by Mubin M. Shaikh
Walkthrough of the process for one of the industry best practices to export all SQL tables in Flat file format
by Alaa Ben Fatma
Explore your MMSQL server tables in a professional way
by Mahsa Hassankashi
Best approach for having more secure channel to transfer user information throughout the web
by Mahsa Hassankashi
This article enables you to generate table in any database such as Oracle, SQLServer, MySQL, SQLite, Sybase, etc. just by typing table name and its fields. Then you can use NHibernate facilities to make query for data layer.

All Articles

Sort by Score

SQL Server 2008 

15 Jan 2013 by Wonde Tadesse
This tip/trick helps to set a default value for blob data type such as Image, VarBinary.
5 Sep 2013 by Mubin M. Shaikh
Create time dimension with 24 hour plus values and time buckets in your data warehouse
14 Aug 2013 by Harmen Brouwer
How to create and deploy a SSRS rendering extension, explained by a functional Zip Rendering extension for SSRS 2005, 2008 (R2) and 2012.
13 Mar 2012 by Tecfield
This tip shows how to rename a database and its MDF and LDF files in SQL Server.
11 Oct 2011 by Enrique Albert
Baseline WCF Distribution Layer - Decoupling of WCF Services and ViewModels.
23 Apr 2012 by Kuthuparakkal
27 Jun 2012 by freedeveloper
A small control to control paging in Windows Presentation Foundation.
16 Mar 2012 by Anurag Gandhi
A Query to copy an individual table data between databases
8 Jul 2010 by Md. Marufuzzaman
How easy to read a file without using of the seven extended stored procedures.
25 Oct 2012 by Enrique Albert
WPF Validation using the IDataErrorInfo interface combined with Validation attributes
16 Jan 2014 by Tom Glick Philadelphia, US
POC to demonstrate passing of collections of complex objects to ASP.NET Web API Controllers.
2 Aug 2009 by Abhishek Sur
Gives an introduction of how to create SQL CLR managed objects in SQL server.
27 Apr 2011 by Niladri_Biswas
This article will discuss about Copy Column, Derived Column, Character Map and Conditional Split Transformation in SSIS with a palindrome example.
21 Feb 2012 by Daniel Miller
This article describes the steps to re-configure SQL Server so that queries return accent-insensitive results. It includes source code (using Microsoft SQL Server 2008 R2 Shared Management Objects) to automate some of the steps in this procedure.
26 May 2013 by Tharaka MTR
This post will show you how to fix orphaned SQL users.
11 May 2012 by P.Salini
You are getting all records for % and _ because those are wildcard characters in Like operator.To know more go through thishttp://msdn.microsoft.com/en-us/library/ms179859.aspx[^]http://www.w3resource.com/sql/wildcards-like-operator/wildcards-like-operator.php[^]
22 Jul 2013 by Paw Jershauge
Want your own movie database??? Download IMDB in 20 minutes.
2 Jun 2017 by AhsanAhmed
A brief introduction on how to use FOR XML clause in AUTO mode in Microsoft SQL Server to return data in XML format
5 Sep 2011 by Wendelius
You define the datetime variable as nullable:DateTime? dt = null;
23 Feb 2012 by Mahmud Hasan
How to use variable in SELECT TOP SQL command
15 Sep 2013 by TheUltimateDebugger
Database operations[^]Hope it will help..
9 Aug 2011 by Jesus Carroll
This brief article show how to install quickly Microsoft SQL Server 2008 Express Edition Standard or with Advanced Services
11 May 2012 by Rockstar_
Hi friend,Keep % and _ in [] brackets defenitly it will come
13 Jun 2012 by Zoltán Zörgő
First of all define the "middle point" in terms of mathematical concepts.If you mean the center of a polygon:Regular Polygon case:In the case of regular polygons the center is the point that is equidistant from each vertex or corner. It is also the center of the polygon's incircle and...
13 Jan 2013 by mparvez
How to load data from an Excel file to load in a dimension table in an incremental way.
20 Jun 2013 by Levente Kupás
If you have big reports which run slowly, you may use this T-SQL based engine to speed-up them.
31 Oct 2013 by Debopam Pal
How to bring data from Entity model to Excel file using LINQ.
30 Jul 2009 by Giovanni Bejarasco
5 Sep 2011 by Prerak Patel
DateTime is not nullable type. You can use Nullable dt;
25 Apr 2012 by Prasad_Kulkarni
Please refer following threads:Beginner SQL Tutorial[^]SQL Server Indexes [^]SQL Server Index Basics[^]Introduction to Indexes in SQL Server[^]A Guide to SQL Server Indexes[^][EDIT]This CP Article will clear all your doubts:Defining Indexes with SQL Server 2005[^]Some...
1 May 2012 by VJ Reddy
The column can be renamed using SP_RENAME 'Student.StudentId', 'SID ', 'COLUMN'as explained hereSQL SERVER – How to Rename a Column Name or Table Name[^]
11 May 2012 by VJ Reddy
The solution 1 and 2 are very good and clearly give the answer for including % or _ literal in the search expression. In case you want to enter the % _ in a normal way, for example from a TextBox from user input and then want to construct the filter expression, the following regular...
12 Jun 2012 by Prasad_Kulkarni
Insert, Update, Delete with Gridview....simple way[^]Updating, Deleting records using GridView control[^]GridView Row Edit, Delete and Update[^]Insert Update Edit Delete Rows Record In GridView[^]
20 Jun 2012 by Manas Bhardwaj
Look at this article: http://blog.sqlauthority.com/2008/04/02/sql-server-find-nth-highest-salary-of-employee-query-to-retrieve-the-nth-maximum-value/[^]SELECT TOP 1 salaryFROM (SELECT DISTINCT TOP 2 salary FROM tbPay ORDER BY salary DESC) a ORDER BY salary
26 Jun 2012 by Wonde Tadesse
Have a look these articles.1.Distributed transactions and TransactionScope [how to get it?][^]2.Entity Framework & Transactions[^]3.TransactionScope and DataAdapters[^]4.Handling transactions in .Net using TransactionScope[^]
6 Jul 2012 by OriginalGriff
That's going to depend on what you have them as in your app. If they are images as seems likely, then varbinary(max) would be a good choice. If they need additional info then you might want to store them in two fields to make separating them before use easier.
17 Sep 2012 by aasim abdullah
Get all indexes list in detail, with their involved columns
25 Dec 2013 by Sergey Alexandrovich Kryukov
You never ever need Visual Studio for anything except development, not even for building .NET projects. Visual Studio is only the IDE.There are different approaches to SQL deployment, but I would advise just to require it as a prerequisite for your product. Don't forget that you need SQL...
22 Jan 2014 by Sergey Alexandrovich Kryukov
The best algorithm for storing passwords is not storing any passwords; this is unsafe and absolutely not needed for authentication.Surprised, disagree? Please see my past answers:i already encrypt my password but when i log in it gives me an error. how can decrypte it[^],Decryption of...
18 Dec 2015 by Md. Marufuzzaman
This tip shows you an easy way to split Microsoft SQL Server table row data.
31 Oct 2016 by Chris Maunder
Timing SQL calls with millisecond accuracy
10 Nov 2010 by Abdul Quader Mamun
17 Feb 2011 by John Gathogo
Catastrophic results associated with unqualified use of columns belonging to tables referenced on main query in a subquery
29 May 2011 by Kim Togo
I think the easy solution is to.string search = "\"business adminstration\"";search = search.Replace("\"", string.Empty);search = search.Replace(" ", " and ");Console.WriteLine(search);Output:business and adminstrationOr perhaps work with regular expression.
19 Jul 2011 by walterhevedeich
You can't return multiple values from stored procedure in the way you are doing it now. You can, however, specify your parameters to be OUTPUT so you can access them. See here[^] for additional explanation.
5 Sep 2011 by Abhijit Jana
Well, Here is the fundamental stuff of nullable DateTime. DateTime struct itself does not provide a null option. but we can make it a nullable type which allows you to assign the null to a datetime.DateTime ? nullableDateTime = null ; if(nullableDateTime.HasValue) ...
11 Sep 2011 by Abhinav S
SQL Server does not have a TRIM function. It has LTRIM and RTRIM that you can use together. There is no MID or RIGHT as well. You need to use SUBSTRING instead[^].
11 Oct 2011 by Chris Maunder
A quick script to enable you to find the processes that are blocking in SQL server
4 Apr 2012 by sluaghtered
Script Runner that can run multiple SQL script files on MS-SQL.
4 May 2012 by thursunamy
You can check from the linkshttp://blog.sqlauthority.com/2007/03/05/sql-server-quoted_identifier-onoff-and-ansi_null-onoff-explanation/[^]http://praveenbattula.blogspot.com/2009/05/use-of-set-ansinulls-on-in-sql-server.htmlANSI_NULLS ONThis option specifies the setting for ANSI...
9 May 2012 by Wendelius
And a bit different approach. DECLARE @RefDate DATETIME = CONVERT(datetime, '01.01.1900',104);DECLARE @Seconds int = 92730;DECLARE @CompareDate datetime = DATEADD(second, 92730, @RefDate);SELECT @Seconds, CAST(DATEDIFF(HOUR, @RefDate, @CompareDate) AS varchar(100)) +...
16 May 2012 by walterhevedeich
You need to specify the fields of the values you want to insert on your statement if you are not inserting values to all of them. Since you haven't provided the fields, it assumes that you want to insert to all of them, hence the error. An example of how to do it would beINSERT INTO Table1...
27 May 2012 by Prasad_Kulkarni
Yes you can, please refer Date time formats[^]Or elseTry this:SELECT LTRIM(RIGHT(CONVERT(VARCHAR(20), GETDATE(), 100), 7))
15 Jun 2012 by Manas Bhardwaj
You should have googled with the error message. LMGTFY[^]The first link itself gives the answer:http://support.microsoft.com/kb/956176[^]To change the Prevent saving changes that require the table re-creation option, follow these steps: 1.Open SQL Server Management Studio...
17 Jul 2012 by Mmohmmad
Dear Friends:I have a wpf application and I want to store my data in a SQL file. The SQL file has some sensitive content and in order to protect its content I have decided to enctypt them by Rijndael algorithm (because as I read this algorithm is the optimum one (fast and secure)). The...
17 Aug 2012 by ManojKumar19
Update row column with another row column in same table SQL only if it is null.
28 Aug 2012 by akhil khare
Find multiple strings (delimenated by space) in all selected columns.
9 Sep 2012 by Prasad_Kulkarni
Have a look:Pinal Dave: Create Script[^]MSDN: How to: Generate Create Scripts[^]Generate a Script (SQL Server Management Studio)[^]..and lot more similar threads here[^]
9 Sep 2012 by Mohamed Mitwalli
Hi , Right Click on Database name on object explorer select Tasks then Generate Script Click Next Then select the objects you want to Script it or leave it for the whole DatabaseNext Click on Advanced Choose Script Drop and Create Version of sql select Type of data to script You will...
20 Oct 2012 by aasim abdullah
How to Refresh Intellisense Cache in SQL Server
13 Dec 2012 by Paw Jershauge
MS SQL system views, mapped over version.
29 Dec 2012 by Sheikh Muhammad Haris
c.* is the problem here. As you are using Group By clause, you have to mention only specific column names in your select list that are in group by.Try this instead.select p.empid,COUNT(p.empid) from empcdetails c inner join emppdetails p on p.empid=c.empid where empstatus =...
27 May 2013 by Tharaka MTR
Generate insert statements from a specific table data using SQL Server
9 Oct 2013 by Rakshith Kumar
I altered the table and rewrote it ascreate table customer(customerid int identity(1,1) primary key,customername varchar(50),cemail varchar(30) unique,sound varchar(50) );for this table i created a on insert triggersomething likecreate trigger setsound on...
24 Mar 2014 by Tomas Takac
This is exactly what recursive CTE is for:with cte as( select * from mytable where child = 100 union all select t.* from mytable t inner join cte on cte.parent = t.child)select parent from cte
24 Jun 2015 by Khaled Abdelhamid
Drawing on a web page on the fly using GDI+ and Flood-Fill Technique
27 Jun 2016 by Maciej Los
In addition to solution1 by OriginalGriff[^], i'd strongly recommend to read this article: Visual Representation of SQL Joins[^]
1 Jun 2017 by AhsanAhmed
A brief introduction on how to use FOR XML clause in EXPLICIT mode in Microsoft SQL Server to return data in XML format
4 Sep 2010 by Jaime Olivares
How to Insert or Update an SqlGeography object in SQL Server 2008 from a C# application
7 Dec 2010 by Blesson Mathew
hi,,jus select the image name from database.and insert it into a view data..nd select the view data as the image source.ViewData["name"]="path where the image is stored"+"imagename"one example is given belowViewData["icon"] = "../../UserImage/" + data.Icon;and select the viewdata as...
1 Jan 2011 by thatraja
OP wrote:1. My home page became very heavy. Why?May be you are loading heavy number of nodes in treeview. Also check this one too Treeview node limit[^]OP wrote:2. No Cacheing is applied yet. I want to apply cacheing on the page.. Problem is, every content on the page is Dynamic .I think I...
9 Feb 2011 by Sergey Alexandrovich Kryukov
All this technology is well presented in .NET. You created all resources in English, not using a single string constant for UI, all in resources. It provides Globalization: http://msdn.microsoft.com/en-us/goglobal/bb688139[^], http://msdn.microsoft.com/en-us/library/401dkz3c.aspx[^],...
29 Mar 2011 by OriginalGriff
First thing that isn't going to happen: I won't download a random rar file from a stranger. I have no idea what it contains, and I am not about to find out.If the code inside is relevant, then post the relevant fragments in your question.Secondly, even if I did download and example your...
7 Apr 2011 by Sandeep Mewara
Read on SQL Transaction. Here: SqlTransaction Class for ADO.NET way[^]BEGIN Transaction - DB way[^]COMMIT Transaction - DB way[^]Using them, if needed, you can either commit all or rollback all based on failure of any one.
25 Apr 2011 by thatraja
This bunch may help youDeploy SQL Server databases easily with an Installer class[^]Extending Visual Studio Setup Project[^]dotNetInstaller - Setup Bootstrapper for .NET Application[^]A Setup and Deployment project that passes parameters to the configuration file[^]Restoring...
18 May 2011 by mhwasim
You both functions can be converted into one nested query which will be much faster than the logic distributed into 2 funtions....Thanks
9 Sep 2011 by Corporal Agarn
Did you try:SELECT DISTINCT Exercise.ExerciseName, Exercise.MuscleTarget, Exercise.SetsReps, TrainingProgramExercise.DayNumberFROM ExerciseINNER JOIN TrainingProgramExercise ON Exercise.ExerciseID = TrainingProgramExercise.ExerciseIDWHERE TrainingProgramExercise.DayNumber = 1
21 Sep 2011 by Mario Majčica
Well by saving your connection string in a web.config (or app.config) file.Add something similar: ...
9 Nov 2011 by Om Prakash Pant
You can also use COALESCE for this.DECLARE @myCity VARCHAR(MAX)SELECT @myCity = COALESCE(@myCity +',' ,'') + CityColumnFROM Table1SELECT @myCity--@myCity will have the values as--Mumbai,Banglore,Chennai,Colcutta,Delhi,Ahmedabad
23 Nov 2011 by Mehdi Gholam
Use BULK INSERT see here for an example : http://www.sqlteam.com/article/using-bulk-insert-to-load-a-text-file[^]
10 Dec 2011 by Amir Mahfoozi
One way is write a trigger for every table in which you want to track the changes. And also create another table that has such a structure that can store all of your changed data. For information about triggers...
22 Dec 2011 by Scubapro
select * from currencyorder bycase namewhen 'SGD' then 1else 2end
22 Dec 2011 by thatraja
Amir's answer is enough but here alternative solutionAdd an another column in your table(Ex. Default or DisplayOrder), see below table.ID Name IsDefault-----------------1 INR N2 USD N3 SGD Y4 EURO NUse the Below QuerySELECT * FROM [Table] ORDER BY SGD DESCID Name...
26 Dec 2011 by Wendelius
SQL Server Express Edition has a size limitation of 4GB which cannot be overridden (see: http://msdn.microsoft.com/en-us/library/ms345154(v=sql.90).aspx[^]).One possibility is to upgrade to SQL Server 2008 R2 Express if you want to use free edition or to Standard Edition. In SQL Server 2008...
28 Dec 2011 by #realJSOP
0) Use SQL Server for the database.1) Create your app in the form of either a asp.net web page or a Silverlight module.Writing desktop apps that require deployment adds to the cost. A web site can be accessed by hundreds of users simultaneously, and if deisgned appropriately, it can allow...
28 Dec 2011 by Wendelius
First question I'd ask is what tools, environments, languages etc you're familiar with. The second thing are the requirements. Do you need access to local (client side) resources (disks, drivers etc) or programs (Office interop and so on).Those two should narrow down the possibilities. If no...
28 Dec 2011 by Wendelius
The data type for guid is uniqueIdentifier so your DDL should be something like:CREATE TABLE Employees ( ID uniqueidentifier PRIMARY KEY, Name NVARCHAR(50) NOT NULL ).See: uniqueidentifier (Transact-SQL)[^]
5 Jan 2012 by Prasad_Kulkarni
Hi,Have a look to get best examples of UNION with ORDER BY;http://www.techonthenet.com/sql/union.php[^]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=90153[^]http://www.java2s.com/Code/Oracle/Result-Set/AUNIONquerythatusesanORDERBYclause.htm[^]
31 Jan 2012 by Espen Harlinn
string Org_IpAddress = ips[1].ToString();For this to work there has to be at least two elements in the array.if(ips.Length > 0) { string Org_IpAddress = ips[0].ToString();}if(ips.Length > 1) { string Org_IpAddress = ips[1].ToString();}In c# the firts valid index is...
14 Mar 2012 by OriginalGriff
"in fact i have list box contain several items and want them to several column in the table"That is where it gets harder.If you are assigning one item from your ListBox to each Row, then that is easy - just loop through and execute the appropriate INSERT statement.But a variable number...
8 Apr 2012 by Rahul Rajat Singh
Dont do a connection.open in form constructor. do it before any operation and then make sure to close it.Dispose the connection only when form closes else closing the connection should be fine.
12 Apr 2012 by OriginalGriff
From that little, we can't give you any exact code help: but the error is pretty explicit.ResourceId is in a foreign key relationship with another table, which does not contain the ID you are trying to insert. Insert the value in the Resource table first, or check and correct the value you...
25 Apr 2012 by Praveen Meghwal
Definition:A trigger is a special kind of stored procedure that automatically executes when an event occurs in the database server. DML triggers execute when a user tries to modify data through a data manipulation language (DML) event. DML events are INSERT, UPDATE, or DELETE statements on a...
28 Apr 2012 by Sandeep Mewara
It might be surface area configuration error or sql service configuration issue. Have a look at this thread for potential reasons and resolutions: Resolving A network-related or instance-specific error occurred while establishing a connection to SQL Server[^]If needed, See steps for setting...
29 Apr 2012 by Sandeep Mewara
Have a look at these:Displaying Total in Footer of GridView[^]MSDN: GridView Examples for ASP.NET 2.0: Displaying Summary Data in the Footer[^]CodeSnip: How to Display Sum Total in the Footer of the GridView Control[^]If needed, look here[^] for more.
4 May 2012 by uspatel
When SET ANSI_NULLS ONit means ISO Standard is being followed.means = and should not be used for null comparison.If you want to use = or for null comparison useSET ANSI_NULLS OFFit means do not follow ISO Standard.SET ANSI_NULLS should be set to ON for executing...
5 May 2012 by Sandeep Mewara
See, you have entirely different issue and the way you asked/posted question was in different direction. You were trying to solve for something else. Now, there could be few reasons why you are getting this issue. Easy/direct solution can be adding enableEventValidation="false" in your Page...
10 May 2012 by Leonardo Paneque
Your line txtTravel_Total_Bill_Amount.Text + "'," need a second ',so it would be txtTravel_Total_Bill_Amount.Text + "','" Might I recommend skipping concatenating string for sql? Because is VERY unsecure. Instead try to use parameters :)