sql-server-2005

XML Output is Truncated in SQL

Hi, I need to return my result set in XML and this works fine, but if the number of records are increased, my xml output is truncated here is my query select t.id,t.name,t.address from test FOR XML AUTO, ROOT('Response'), ELEMENTS However I have set some option to increase the output result set like.. Tools --> Options --> Query Resu...

Firing trigger for bulk insert

ALTER TRIGGER [dbo].[TR_O_SALESMAN_INS] ON [dbo].[O_SALESMAN] AFTER INSERT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for trigger here DECLARE @SLSMAN_CD NVARCHAR(20) DECLARE @SLSMAN_NAME NVARCHAR(20) SELECT @SLSMAN_CD...

Syntax error on extracting excel

Create Procedure USP_UploadTraining @filePath varchar(100) AS BEGIN Insert into Training_TRNS (EmpName,EmpJobFunction,EmpRegion,SpeCourse_ID,status,DueDate) select F2+' '+F3 as Name,F4 as JobFunction, F6 as EVPRegion, F7 as CourseTitle,F8 as Status, convert(varchar,F9,101) as DateAcq FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', ...

handling Concurrency in SQL SERVER 2005

Hi, I have one question for you, if you can answer and refer resource it will be great help. I have a scenario where i need to create a appointment slot and a serial no for each slot memberwise. ex: Member Id |App Slot # 1|1 1|2 2|1 2|2 1|3 what im doing is take the Max slot number,increamenting it and insert it memberwise. but...

How to return empty cells for repeated values and keep only the cells which are different ?

I have a query that selects some fields to display from a table SELECT Field1, Field2, Field3, Field4 FROM table1 I want instead of returning : To return: How could I modify my SQL statement to return the second figure ? Or at least how to change the gridview properties of .Net to do so (if this is possible) ? ...

How can I show SQL Server LOGS (2005)

Hello, I'm trying to track the error thrown by SQL Server 2005. The problem is SQL Server reports it in my native language so it's hard for me to google it. I think that the core issue would be avialable in English in SQL Server LOGS. I'm running SQL Server Management Studio Express, going to "Management" node, and then SQL Server Log...

SQL Server: How to iterate over function arguments

I'm trying to learn SQL and for demonstration purposes I would like to create a loop which iterates over function arguments. E.g. I would like to iterate over SERVERPROPERTY function arguments (propertynames). I can do single select like this: SELECT SERVERPROPERTY('ProductVersion') AS ProductVersion, SERVERPROPERTY('ProductLevel') AS P...

Can I create and connect to a SQL Server CE database if SQL Server 2005 isn't installed?

Is there any way to do this? Update: Sorry, I should have included more information. I am trying to create and connect to a SQL CE database using System.Data.SqlServerCe in C# running on a PC (i.e. not running on a Windows Mobile device). This code: string connstr = "Data Source=\"" + filename + "\";Persist Security Info=False;...

ssms cannot connect to default sql server instance without specifying port number

I have multiple SQL Server 2005 instances on a box. From SSMS on my desktop I can connect to that box's named instances with no problem. After some recent network configuration changes, when I want to connect to the default instance from SSMS on my desktop, I have to specify the port number. Before the network changes, I did not have to ...

How to retrieve the rows (with maximum value in a field) having a another common field ?

I have a table; let it be called table1; with the following fields and data I need a query that returns the record with the maximum value in Field3 for each group of records having the same value in Field2. So that the query returns: How could this be done using SQL queries ? ...

SQL to insert latest version of a group of items

I’m trying to determine a good way to handle the scenario below. I have the following two database tables, along with sample data. Table1 contains distributions that are grouped per project. A project can have one or more distributions. A distribution can have one of more accounts. An account has a percentage allocated to it. The distri...

Should I create a unique clustered index, or non-unique clustered index on this SQL 2005 table?

I have a table storing millions of rows. It looks something like this: Table_Docs ID, Bigint (Identity col) OutputFileID, int Sequence, int …(many other fields) We find ourselves in a situation where the developer who designed it made the OutputFileID the clustered index. It is not unique. There can be thousands of records with this I...

LINQ to SQL : Too much CPU Usage: What happens when there are multiple users.

I am using LINQ to SQL and seeing my CPU Usage sky rocketting. See below screenshot. I have three questions What can I do to reduce this CPU Usage. I have done profiling and basically removed everything. Will making every LINQ to SQL statement into a compiled query help? I also find that even with compiled queries simple statements li...

Linking database column to dropdown control in ASP.Net

I am using c# with asp.net and SQL Server 2005 as backend. I want to use dropdown list control in a form to populate a textbox. The dropdown control is linked to a column in the database. How can I code this in c#? ...

Data in column not changed

I have sql 2005 and when i run below query, data from RealTimeLog table transfer to History but when new data come in RealTimeLog table old data not changed by new one means OutTime data is not changed with new data from RealTimeLog. insert into History (UserID,UserName,LogDate, [InTime], [OutTime]) SELECT UserID,UserName,[LogDate],CONV...

Calling sp_rename ( or other sp_ ) for SQL server 2008 from .Net Code

Is my the only option to wrap sp_rename or similar into stored procedure and then sqlCommand.CommandType = System.Data.CommandType.StoredProcedure; sqlCommand.ExecuteNonQuery(); ...

C# send xml to sql

Hello, Can someone provide an example of how to send an xml from C# to SQL Server, and then loop on the xml in the stored procedure that got it, and update or enter line by line. TY ...

Create table on linked server?

Is it possible to create table on linked server? If yes then how? I really appreciate your help. Thank You. ...

SSIS DTS Package flat file error - "The file name specified in the connection was not valid"

I have a pretty basic SSIS package that is attempting to read a file hosted on a share, and import its contents to a database table. The package runs fine when I run it manually within SSIS. However, when I set up a SQL Agent job and attempt to execute it, I get the following error: Executed as user: DOMAIN\UserName. Microsoft ...

C# Winforms ADO.NET - DataGridView INSERT starting with null data

I have a C# Winforms app that is connecting to a SQL Server 2005 database. The form I am currently working on allows a user to enter a large amount of different types of data into various textboxes, comboboxes, and a DataGridView to insert into the database. It all represents one particular type of machine, and the data is spread out ove...