Click here to Skip to main content
15,891,943 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 Updated

SQL Server 2008 

18 Apr 2010 by #Jet
i am trying to generate a dynamic where clause in my store proc.=== @population nvarchar(max)declare @chvSelect varchar(max), @chvFrom varchar(max), @chvWhere varchar(max), @chvOrderby varchar(max), @chvSQL...
25 Jul 2010 by #realJSOP
The unique ID merely identifies the record. Your assumption that one song can only be attributed to a single artist is flawed because many artists might cover the same song. For instance, I know of at least a dozen versions of the title Ghost Riders In The Sky, and some of those versions are...
10 Feb 2011 by #realJSOP
.Net is .Net, it doesn't matter what language you use. All of the same framework features are available to all languages. Pick the one you're most comfortable in, and start writing code. As for designing a database, try searching google with the phrase "how to design a SQL database".
14 Feb 2011 by #realJSOP
Make sure it's configured to allow remote access.
17 Mar 2011 by #realJSOP
try this:set @qry='select '+cast(@count as varchar(32))+' = count(*) from '+@TName;
31 Mar 2011 by #realJSOP
Does the user need/have an account on the server in question (not in sql, but on the box itself)?
14 Apr 2011 by #realJSOP
Do you mean from the sql side of things or the application side? You gotta be a lot more specific. And what do you mean by "orphaned" connections? As far as a .Net application goes, you should ALWAYS close a connection after using it. There are few reasons to keep a database connection open...
17 Jun 2011 by #realJSOP
DECLARE @myVarChar varchar(MAX)set @myVarChar = CONVERT(varchar, @myVarBinary)
24 Jun 2011 by #realJSOP
Put this in your web.config:Error 500 is too generic to diagnose.Once you do that, it will give you the precise locatoion that is causing your site to misbehave, and from that point, you can probably identify the problem and fix...
16 Jul 2011 by #realJSOP
Neither the web nor SQL are what I call "push" technologies. You actually have to actively request information from both. That means you have to periodically query the database, or actually make a web request in order to receive information. You can try using a thread to accomplish the database...
5 Aug 2011 by #realJSOP
0) You haven't told us HOW you're calling the stored proc from your service. However, if you're using the SqlConnection/SqlCommand method, you can improve performance by only creating/opening the connection and command objects one time for each update/insert cycle. // allocate your...
29 Aug 2011 by #realJSOP
http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277[^]
7 Sep 2011 by #realJSOP
You could try one of these:0) Retrieve data in smaller chunks1) Try changing the CommandTimeout property in the SqlCommand object to a higher value (the default is 30 seconds).2) Use the asynchronous functionality in SqlCommand (BeginExecuteReader).EDIT ===================Why...
18 Oct 2011 by #realJSOP
124 million Google search results for "setup windows network"[^]After you've setup your network, install Sql Server on one of the bxes, and the only thing that remains is coming up with the correct connection string to use in your program.Connection string samples[^]
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...
13 Mar 2012 by #realJSOP
I wouldn't store a method name in the database. I would store a (numeric) indicator that tells the code which method to use for the delegate. That way, the method name can be changed (if desired/required), and the database doesn't need to (and shouldn't need to) know about it.
22 Sep 2017 by #realJSOP
It doesn't always happen the way you expect.
24 Feb 2013 by $ultaNn
i want my id as output when i submit the record i want to see the ID of that record i m trying this i am not getting any thing ALTER PROCEDURE [dbo].[Tech_sup] ( @Build_name varchar(max), @Dept varchar(max), @Floor_no varchar(50), @Call_recvd varchar...
3 Jun 2013 by $ultaNn
I Have four table Order_RequestTbl_PrinterTbl_MonitorTbl_CPUI have a relation FK_Tbl_Order_Request_Tbl_CPU and FK_Tbl_Order_Request_Tbl_Monitor FK_Tbl_Order_Request_Tbl_Printerwhen i try to enter data for moniter in Order_Request its giving me error The INSERT statement...
23 Jul 2013 by $ultaNn
i have two table Tbl_Device and Tbl_ReceivedQtyI want the sum of record with inner join Device i tried to join with this query but failed SELECT Tbl_Device.Device_Name, Tbl_ReceivedQty.Qty_Device_ID, Tbl_ReceivedQty.Qty_User, Tbl_ReceivedQty.Qty_Date FROM Tbl_Device...
27 Oct 2013 by $ultaNn
i have converted the date from Gregorian to hijri by using this code DECLARE @DateTime AS DATETIME SET @DTime=GETDATE() SELECT @DTime AS [Gregorian Date] ,CONVERT(VARCHAR(11),@DTime,131) as [hijri]i want only converted year so that i can use it in following...
13 Jun 2012 by .net333
Good morning friends, I want to synchronize sql server 2008 data from local database to main server database... I want a sample code for that...can any body help me in this regardThanks in advance
7 Aug 2012 by .net333
hai, i want a delete query for deleting the multiple tables data on daily basis..i.e,the data will be delete every 24 hrs...these are my sp'sdelete from Appointment Where UserId='5effd331-3fa4-4ef4-a358-40babc2890c8'delete from Campaign where...
7 Aug 2012 by .net333
hai, I am facing the problem at writing the stored procedure..i want to delete multiple tables data for particular Id for every 24 hours with out using front end i.e, visual studio..i wrote the stored procedure like this :delete from Appointment Where...
5 Nov 2012 by 07405
Hi...my stored procedure isselect count(TaskId) as tasks from Task T,Provider P where P.UserId=T.UserId and T.permissions='False' and T.State='Close' and T.Assignedto=@Assignedtoselect count(TaskId) as tasks1 from Task T,Provider P where P.UserId=T.UserId and...
8 Jun 2013 by 16041984
IN my application i am using vb.net and sql server 2008.my application hosted in US server so it takes time from US server.Users us application in INDIA they want to change time from US to INDIA.the change is in start time and END time in stored procedure as follows.plz provide me help...
10 Apr 2011 by 1941986
hello,my question is "i have some dates in Employee table like as 01/01/2011,01/01/2010,24/02/2010,19/12/2009,07/07/2008,21/12/2009,24/08/2010,03/03/2011,01/04/2011. " When i run this query "select MAX(DateOf_joining) from Employee " i found this answer "24/08/2010".also i...
19 Oct 2011 by 2011999
Dear Experts, SQL Server Database in ZIP file how to fetch the databases in SQL Server Existing databases.Thank you for valuable replay.
5 Nov 2011 by 2011999
protected void Timer1_Tick(object sender, System.EventArgs e) { DateTime mydate2 = DateTime.Now; DateTime mydate3 = default(DateTime); try { mydate3 = (mydate - mydate2).ToString(); this.Label5.Text = "Time Left: " + mydate3.ToShortTimeString(); } catch...
9 Jan 2012 by 2011999
I am using SQL Server 2008R2 Management Studio
28 Jan 2012 by 2011999
Dear All,my quation is one table relation to how many tables related. how to find out table relation. i need how to find out relation through sql command .
30 Jan 2012 by 2011999
Error Message :The SelectCommand property has not been initialized before calling 'Fill'.
30 Jan 2012 by 2011999
Server Error in '/RetriveData' Application.--------------------------------------------------------------------------------Could not load file or assembly 'firebirdsql.data.firebirdclient' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded...
7 Feb 2012 by 2011999
when i am run my program. only first employee details is i got it. i am select second employee not retrive the second employee. only first employee details is retrive it.how i am got selected employee details in my web form. protected void Page_Load(object sender, EventArgs e) {...
10 Feb 2012 by 2011999
Dear All,Install my system payroll software exe and after that add the database server authentication connection successful. but not open the application. plz urgent give me a solution.databse connection through controlpanel--->admin-toos> hear my connection successfully connected to...
12 Feb 2012 by 2011999
Dear All,I was write a program for Excel Spredsheet data to SqlSarver database. when i am running a program i got this error(Upload data excel to Db) Near the cmd.ExecutenonqueryCannot insert explicit value for identity column in table 'Emp' when IDENTITY_INSERT is set to OFF. ...
5 Mar 2012 by 2011999
Dear Allpublic void insertdataintosql(string sgd_id, string sgd_sgp_id, string sgd_hed_id, string sgd_type, i got this error violation of FOREIGN KEY constraint "FK_SAL_SGD_SAL_PTG" on table "SAL_SGD"Foreign key reference target does not existhow to resolve this one
24 Feb 2012 by 2011999
CREATE TABLE empDetails ( EMP_ID int(11) primary key NOT NULL,password varchar(10) NOT NULL); obove table relation to below table.CREATE TABLE LEAVE_DETAILS_ADMIN ( EMP_ID int NOT NULL foreign key , leaveEarnedCredit float(2), leaveCasualCredit float(2), ...
24 Feb 2012 by 2011999
CREATE TABLE empDetails ( EMP_ID int(11) primary key NOT NULL, password varchar(10) NOT NULL);First tabel is crete. i got error second table. i am using manaement studio 2008R2.CREATE TABLE LEAVE_DETAILS ( EMP_ID int(11) foreign key NOT NULL, ...
29 Feb 2012 by 2011999
Dear AllHow to delete forigen key reference table rows.table 1:id, name (heare Id is primary key)table 2:Emp_ID, dept, ID (here id is forigen key reference)
29 Apr 2012 by 2011999
Dear All,In my Existing database 2005 now we are planning to shifted data to 2008 before move data what are the steps needed.
8 May 2012 by 2011999
Dear All,one penal two radiobuttons we select one radiobutton. selected radiobutton store in database how to write the code?
9 May 2012 by 2011999
I have created a table, and now I need to add a column to it. How would I go about this?
10 May 2012 by 2011999
Dear ALl,Unclosed quotation mark after the character string ')'. Incorrect syntax near ')'. SqlCommand cmd = new SqlCommand("INSERT INTO lta_declaration VALUES ('" + txtLTA_Destination_To.Text + "','" + ddl_Transport.Text + "','" + txtDT_From.Text +...
10 May 2012 by 2011999
Dear All,we are developing one application. we are analise database . master table relation to 15 tables. in master table in emp_no primare key, remaining tables is foregen key. am i right? in our application login in to employee based on emp_no when employee login to the application onle...
10 May 2012 by 2011999
Dear all,if more than one check boxes using in application, must and should take group or notPlease correct me. give me example.
11 May 2012 by 2011999
Dear All,i need add the text box values defaultly one doubt for this as per in sql statement, all fields must be need values. if one field value not enter valur show in error message. how to resolve this error.txtOSITotalIncome.Text = txtOSIInterstFromBank.Text +...
11 May 2012 by 2011999
below SqlStatement values must enter other wise not work this sqlStatement. if we are not fill one textbox value, how it work successfully this statement. try { con.Open(); SqlCommand cmd = new SqlCommand("INSERT INTO other_source_income VALUES ('"...
14 May 2012 by 2011999
not converted date to "0" if (txtDate.Text.ToString() == "") txtDate.Text = "0";
14 May 2012 by 2011999
Create Proc [dbo].[prcLoginv] ( @Username VarChar(50), @UPassword varChar(50), @OutRes int OUTPUT ) ASset @OutRes = (SELECT count(*) FROM [dbo].Log_UsersWHERE Username = @Username And [Password] = @UPassword)if(@OutRes = 1)beginset @OutRes 1--Login is...
15 May 2012 by 2011999
string connection = System.Configuration.ConfigurationManager.ConnectionStrings["itax"].ConnectionString; SqlConnection con = new SqlConnection(connection); con.Open(); SqlCommand cmd = new SqlCommand("SELECT @UserId 'UserId',@userPassword 'userPassword' FROM...
15 May 2012 by 2011999
master table in em_id is primary key. and master table related to the 8 tables these 8 tables em_id isforigne key. when i am enter table one field values i got the eeror. login page table given master page related to loginallready given em_id. when i am enter table one valures i got this...
16 May 2012 by 2011999
when i am enter values in textboxes store in database. if not equal fields and textboxes how to insert values in database i got this error Column name or number of supplied values does not match table definition. USE [Incometax]GO
16 May 2012 by 2011999
Dear All,Master table in emp_no field is there others table in 4 fields is there how to give the emp_no field these four tables in forigen key reference.
16 May 2012 by 2011999
don't match with existing primary key or unique constraint.i created two tables one is emp and second table is income table emp table emp_id how to give forigen key reference income table
17 May 2012 by 2011999
i have three tables A,B,CA columns id,d,eB columns id,f,gC columns id,h,i here three columns in id is same i need one id and three tables information outputid, d,e,f,g,h how to write command
21 May 2012 by 2011999
Dear All,i need steps. how many tables createi need sent mail with attachment in asp.net coding but one condition emp_id = email_id then send email other wise not sent mail.
22 May 2012 by 2011999
SqlCommand cmd = new SqlCommand("SELECT * FROM SendP WHERE Emp_Id = Email);comparing two fields in one table. example: if two fields are equal that means given values. condition is success other wise fail. in need how to write command in sql or stored procedure
24 May 2012 by 2011999
protected void Page_Load(object sender, EventArgs e) { string connection = System.Configuration.ConfigurationManager.ConnectionStrings["itax1"].ConnectionString; SqlConnection con = new SqlConnection(connection); con.Open(); SqlDataAdapter da; ...
29 May 2012 by 2011999
in my sql server 5 data bases, these 5 databases 5 users my quation is whenever first user login to database remaining 4 databases con't see the first user how to set the setting.
30 May 2012 by 2011999
i got this errorThe specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
31 May 2012 by 2011999
protected void btn_View_Click(object sender, EventArgs e) { TextBox tb = (TextBox)Master.FindControl("txtEmployee_code"); comm.Connection = con; con.Open(); { SqlCommand cmd = new SqlCommand("select osi_int_from_bank='" +...
15 Jun 2012 by 2011999
i was already created table this table some data after that i change the desing: i got this error. how set the settings Management studio 2008R2I got this ErrorSaving changes is not permitted. The changes you have made require the following tableto be droped and re-created. you...
24 Jun 2012 by 2011999
Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.
25 Jun 2012 by 2011999
/* returns all roles for the specified user */ALTER PROCEDURE [dbo].[GetRolesByUser_SP]( @emp_id int)ASSELECT Roles_Payroll.RoleName, Roles_Payroll.RoleIDFROM Payroll_UserRoles INNER JOIN Users_Payroll ON Payroll_UserRoles.UserID =...
10 Jul 2012 by 2011999
I'm trying to create a form where the user gives number to generate textboxes. when for example the user enters 3 into textbox, three text boxes get generated in the new frame. now when the user write data into these text boxes I want it to be saved in MYSQL database. Anybody please help me into...
13 Jul 2012 by 2011999
string stryisactive = Convert.ToString(arrLIst[7]); if (stryisactive == "true") { stryisactive = "1"; } else { stryisactive = "0"; ...
13 Jul 2012 by 2011999
TITLE: Microsoft SQL Server Management Studio------------------------------Attach database failed for Server 'AM-PC\SQLEXPRESS'. (Microsoft.SqlServer.Smo)For help, click:...
14 Jul 2012 by 2011999
Dear All,I am attaching the Database. i got the Read-Only, how to detect Read-Only. i need edit that database. i am using SQL Server 2008 R2.
15 Jul 2012 by 2011999
Failed to convert parameter value from a String to a Boolean. this is error message
16 Jul 2012 by 2011999
Dear all,How to create webform dynamically and store form values in Database. (TextBoxes and Lables)
18 Jul 2012 by 2011999
Table table = new Table();table.ID = "Table1";Page.Form.Controls.Add(table);Hear Creting 10 lables id is generating 0,1,2....10. i need how to change the 0 to Name1, 2 to name2 ....
23 Jul 2012 by 2011999
my table field name "name" hear 10 values only i got first row of value how to get the 10 values.string name1 = Convert.ToString(lst1[0]);
30 Jul 2012 by 2011999
var parametertaxitem = new SqlParameter("@taxitemid", SqlDbType.Int, (50));parametertaxitem.Value = valu121;parametertaxitem.Value = value22;myCommand.Parameters.Add(parametertaxitem);here i get last value of value22, i need both values of value121, and value22 how to get it.
31 Jul 2012 by 2011999
how to insert data like belowid --> 100 1 100 2 100 3 100 4id --> 101 1 101 2 101 3 101 4 after insert the above. next time not inserted only once inserted.
5 Aug 2012 by 2011999
i have four textboxesfirst two texboxes show the sumand last two textboxes show the sum when i am curser down how to automatically calculate the sum. with out use any script language. is it posible to write codetextbox.
22 Aug 2012 by 2011999
Id Date1 1/08/20122 13/08/20123 14/08/2012when i am select record '3' update i need change the date today
5 Sep 2012 by 2011999
[HttpPost] public ActionResult Create(other_source_income other_source_income) { if (ModelState.IsValid) { db.other_source_income.AddObject(other_source_income); db.SaveChanges(); return...
5 Sep 2012 by 2011999
How store database date formate: 24-sep-12:HH:MM:SS (system current date time)
10 Sep 2012 by 2011999
private EmpDetailsEntities db = new EmpDetailsEntities();//// GET: /OtherSource/public ViewResult Index(){ var other_source_income = db.other_source_income.Include("login_user"); return View(other_source_income.ToList()); }in this application two...
25 Sep 2012 by 2011999
public ViewResult Index() { var ded_table = db.ded_table.Include("login_user"); return View(ded_table.ToList()); } [HttpPost] public ActionResult Create(ded_table ded_table) { if (ModelState.IsValid) {...
7 Oct 2012 by 2011999
public ActionResult Create(ded_table ded_table, login_user luser) { if (ModelState.IsValid) { var str = (from li in db.login_user where li.EmpId == luser.EmpId select new ...
29 Oct 2012 by 2011999
public class Service1 : IService1 { string IService1.create(Class1 bobj) { string userid = string.Empty; SqlConnection con = new SqlConnection("conn"); con.Open(); SqlCommand cmd = new SqlCommand("sp_UserDetails",...
5 Nov 2012 by 2011999
string query = string.Format( "Select {0}.{1},{2},{3}, {9}.{4},{5},{6} ,{7},{8} From {0} ;i got this error Syntax error in string in query expression '(Mid(AttendanceLogs.InTime,EmployeeId,0) = Mid(Format(DateAdd(AttendanceDate,-4, NOW()), 'YYY-mm-dd),EmployeeId,0))'.
22 Nov 2012 by 2011999
CREATE TABLE [dbo].[Deduction_1]( [Id] [bigint] IDENTITY(1,1) NOT NULL, [Ded] [numeric](18, 0) NOT NULL, CONSTRAINT [PK_Deduction_1] PRIMARY KEY CLUSTERED ( [Id] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS ...
22 Jun 2014 by 2011999
In MVC3 How to add Register Form in Login Page?
25 Jul 2012 by 2011999
insert into ETiP LEFT OUTER JOIN TIMP where TIMP.tid = ETiP.tid and ETiP.amount = '0' .left outer join EMP ETiP.emp_id = EMP.em_id
6 Jan 2014 by 24983
How to calculate business hours between days in sql server 2008?Please help let me know very urgently.
11 Jan 2009 by 6opuc
Fast and easy to use data access class library.
16 Oct 2013 by 7045Jeegnesh
Select Visits.cMSLClass, Visits.iVisitCnt, Count(Visits.nMSLNo) As iMSLCnt,convert(varchar(20),Visits.iYear) as iYear From ( Select KPIActualDtl.cMslClass, KPIActualDtl.nKPIHdrNo, KPIActualDtl.nSpecialtyNo, IsNull(MslMergingDtl.nToMslNo, KPIActualDtl.nMSLNo) As...
14 May 2012 by @BangIndia
Hi all,Is possible to create 2 domain controller in server 2008 R2 Machine
8 Mar 2011 by @nuraGGupta@
Stored Procedure : Its reusable and pre-complied. So, will save compilation time each time when being called.
9 Jul 2012 by __TR__
If i understand this correctly, you are trying to store all the sub work Names of a particular Work Type in a table.You can design your tables as shown in the below sample.All the Work types will be stored in table Work_TypeAll the Sub Work Types will be stored in table...
18 Jul 2012 by __TR__
Try storing your data in a temp table as shown belowcreate PROCEDURE [dbo].[searchresult] @PageIndex INT ,@PageSize INTASBEGIN SET NOCOUNT ON; SELECT ROW_NUMBER() OVER ( ORDER BY [id] ASC )AS RowNumber ,[id] ,[title]...
1 Aug 2012 by __TR__
Try the below approachCREATE TABLE #Temp( EmployeeID INT, [Level] VARCHAR(50))INSERT INTO #TempSELECT 101, '1,2,3' UNIONSELECT 102, '2,3' UNIONSELECT 103, '1,3'CREATE TABLE #Temp2( [Level] INT)DECLARE @ColumnVal VARCHAR(100)DECLARE @Level...
2 Aug 2012 by __TR__
TrySELECT COUNT(*) AS [Count], '1' AS [Level] FROM [YourTableName] WHERE Level Like '%1%'UNIONSELECT COUNT(*) AS [Count], '2' AS [Level] FROM [YourTableName] WHERE Level Like '%2%'UNIONSELECT COUNT(*) AS [Count], '3' AS [Level] FROM [YourTableName] WHERE Level Like...
2 Aug 2012 by __TR__
Try thisCREATE TABLE #Temp( GroupID INT, ReleaseDate DATETIME)INSERT INTO #TempSELECT 101, '7/30/2012' UNIONSELECT 101, '8/1/2012' UNIONSELECT 102, '7/31/2012' UNIONSELECT 102, '8/2/2012' UNIONSELECT 102, '8/5/2012' UNIONSELECT 103, '8/1/2012' UNIONSELECT 103,...
26 Aug 2012 by __TR__
This is a very basic question. I would recommend you to try this on your own.If you are not sure on how joins work in SQL you can refer the below link.Join fundamentals[^]SQL SERVER – Introduction to JOINs – Basic of JOINs[^]if you are new to SQL you can go through some tutorials...
26 Aug 2012 by __TR__
Hi,Refer this thread.Searching The Stored procedure[^]
27 Aug 2012 by __TR__
Refer Simple Example of Reading XML File Using T-SQL[^]