How to handle & symbol in XML input in SQL Server stored procedure?

I have an update stored procedure which takes @XML as input parameter. The XML is as below: <Root> <data> <FriendlyName>abc</FriendlyName> <URL>http://abc.aspx?view=Approval&Business=XYZ</URL> </data> </Root> When the stored procedure is executed, it throws error XML parsing: line 5, character 141, semicolon expected It is failing because of the & symbol, instead it expects &amp;. So, how to […]

sql server date recursive

based on another question SQL Server: How can you turn a series of consecutive begin and end datetimes into a single begin-end range? I search a recursive way to get the last date of downtime. I have 3 downtime linked. I want to know when my service will be available. Sample DECLARE @Downtime AS TABLE(id […]

Multiplying across row in a query

I have rows in table that i want to multiply all the values by itselft, but can’t figure out how to make it work. SELECT exp(bet_odd) as odds FROM betting

Bulk insert task fails, BUT actually succeeds?

I made a simple bulk task to load data from a 3-4 kb csv (.txt) file. All the data is loaded correctly and yet SSIS shows that its failed. I don’t get it. Why ? The so-called error is – [Bulk Insert Task] Error: An error occurred with the following error message: “Bulk load data […]

Updating Parameters In Data Source for a Report Viewer ASP.NET C#

I have the following controls: Data Source, Report Viewer, and two Telerik RadDateTimePicker. Screen shot of what my Rad Controls look like. My report is a client report definition (.rdlc). I have a stored procedure in my SQL 2008 database that I am using for the report, and the data source. I have configure with […]

Using 2 same values in 1 row -> SQL 2008 table

I’ve searched for this thingy a lot.. and I can not find a solution since I’m beginner in SQL itself. I used to edit games database. now, I need to create a new table with 1 row called “CodeName128” and it should contain the same value many times.. when I place something like CODE_NAME1 CODE_NAME1 […]

How can I update my SQL table in C#?

I created a program that requires a database and I am using Visual Studio and SQL Server to do it. My problem is that I cannot update my table. I found the solution here. My code is below: this.customersTableAdapter.Update(this.northwindDataSet.Customers); tabelAdapter.Update(ABCDatabaseDataSet**.Barber)**; But it gives me an error that the ABCDatabaseDataSet does not have Barber. There is […]

can't get arabic letters from sqlserver using java

I’m trying to retrieve result from MS SQL Server using netbeans. the problem is when I retrieve Arabic words from the database I receive it as ????? . Any one can help ? and here is the code: Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”); Connection conn = DriverManager.getConnection(“jdbc:odbc:yasser”); System.out.println(“test”); Statement sta = conn.createStatement(); String Sql = “select * from mainn […]

SQL Server date format handling

I am running the SAME Delphi 2007 code on two different Windows 7 machines and accessing the SAME SQL server database on a remote server. On one machine a date in the database is read in the format 2013-01-25 00:00:00.000 which causes the application to crash when it tries to convert this date to a […]

TSQL Join and Group Xml Column Values

I have a table like this; I want to sum each first 5 columns and string join with comma values in xml column. (It store results like this : <r><p>example</p><p>example2</p></r>) select sum(Value1), sum(Value2), sum(Value3), sum(Value4), sum(Value5), (select t.c.value(‘.’, ‘varchar(400)’) + ‘,’ from Xml.nodes(‘/r/p’) as t(c) for xml path(”)), DateTime as DateTime from table group […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.