sql-server

Long/multiple SQL queries vs Serialization

I'm trying to improve the performance of my web app where a page does a long query to pull data from different tables on a database. It pulls invoice data with multiple item lines, invoice status, and with each line having additional properties from another table. Is serialization worth considering for improvement? The tables are relate...

mssql sever datainsert error

I try this code this is problem to pass value in mssqlserver i pass value one page to another page in hear nrno is value come to other page but hear error is java.sql.SQLException: Invalid column name 'nrno'. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <%@ page imp...

select value from sqlserver problem

i have write code hear i have problem of selecting value from sqlserver i pass the value from nrno is geting by another page <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <%@ page import="java.sql.*" %> <%@ page import="java.io.*" %> <% String AppURL = request.getCo...

SQL Server 2008 - Selecting multiple rows from OPENXML statement

Hi All, I have an XML file and I open that in SQL Server using OPENXML and then read the values in the XML file and insert them into the table. Assume that the XML structure is like this "<Student><name>XYZ</name><id>123</id><fathersname>XYS</fathersname><fathersid>3489</fathersid></Student>". Now I need to add this as two different row...

Simplest solution for high availability of SQL server 2008?

I have a bunch of SQL servers which I periodically performs maintainance on (Windows Update patches etc.). Now I want to the database online 24/7 and need to implement one of the high-availability solutions for SQL server. The solutions needs to be cheap and simple to use. I have no problems tweaking the connection strings for the clien...

SQL Server User Instances

Hi all, i have been having this problem and wondering if u guys could steer me in the right direction. i have created a web app, and i have the .mdf files in the App_Data folder. i have create a web setup project for this. everything installs 100%. But because the server( or machine ) that i install the project on doesnt have user instan...

Calling resultsets from a storedproc

Hi, I am using SQL 2000. I have a stored proc (spGetApplicantList) which cannot be modified. I need to get the unique LastNameInitials of all the records in that stored proc, so the list of applicants can be sorted alphabetically. Basically what I need is Select DISTINCT LEFT(LastName, 1) as [LastNameInitial] from spGetApplicantList Or...

Why doesn't SQL Server automatically up-convert DATE to DATETIME for comparison purposes?

I love the new DATE datatype in SQL Server 2008, but when I compare a DATE field to a DATETIME field on a linked server (SQL 2005, in this case), like this: DECLARE @MyDate DATE SET @MyDate = CONVERT(DATE, GETDATE()) SELECT * FROM MySQL2005LinkedServer.SomeDB.dbo.SomeTable WHERE SomeDatetimeField < @MyDate I get this error: OLE D...

Should I use an inline varchar(max) column or store it in a separate table?

I want to create a table in MS SQL Server 2005 to record details of certain system operations. As you can see from the table design below, every column apart from Details is is non nullable. CREATE TABLE [Log] ( [LogID] [int] IDENTITY(1,1) NOT NULL, [ActionID] [int] NOT NULL, [SystemID] [int] NOT NULL, [UserID] [int] NOT NULL, [LoggedOn...

SQL Server Date Formats -- ddd

How do I get the day of the week (in ddd format, so Mon, Tue etc.) in SQL ? I don't see anything about it in the CAST and CONVERT documentation.. ...

Linq to SQL SP is returning multiple recordsets when I only want one!

Hi I have the following SP, however when I use LINQ to SQL it generates 2 multiple recordsets. For my sanity I am trying to fathom out what it is in the stored procedure that is doing this and would like to only return a single recordset... Can any help? ALTER PROCEDURE [dbo].[CheckToken] @LoginId int AS BEGIN ...

Can sqlcmd be used to dump table structure and data?

Is it possible to use the sqlcmd command to dump table structure the way it can be done with mysqldump? ...

SSIS package having problem with datename(dw,datum) converting to varchar

I am moving data into a DW using SQL Server SSIS and have the following SQL to populate one dimension SELECT DISTINCT cast (datename(dw,datum) as varchar(10)) as veckodag FROM XXXXX.dbo.Bought as I have VARCHAR in the target column I need to CAST/CONVERT Question how to convert Unicode to Varchar? I get *> Validation error. Datu...

SQL summary row after details...

Hi Stackoverflow super stars... Here's my problem. I have a stored procedure that outputs a pretty straightforward table of grouped and summed values. Typical stuff... company name, number of clients at a company, business rep for the company, annual revenue for the company, etc. That works fine. What I need now, is the summary row....

Calling SQL Server database from Unix

With oracle currently there is a way to call a database through a command prompt using sqlplus. I'm wanting to know if there is a way to call a SQL Server server the same way so that I can have a shell script do it for me. Is there a way? ...

Generic database logging system: Storing a reference to another database.table.column

My question is, how can I link a reference stored in the Log table to a piece of data in another database? We're building a system (Called Fusion) that will perform certain key tasks for all our other systems, one of these is a logging. The idea is that any other system will be able to use Fusion to log specific operation. CREATE TAB...

How does BULK INSERT work internally ?

Hi , Could someone please explain how does BULK INSERT internally work and why is it much faster than the normal INSERT operations ? Regards, Shishir. ...

SQL Server 2008 Replication vs Manual Database Updates

Our scenario: We have a main database that stores company-wide information. We have several retail locations which have their own databases they work off of. These locations need to use information in the company-wide database, and I do not want our main application to run cross database queries because if the main database has issues (...

XML-to-SQL Mapping

We're looking for a way to parse large amounts of XML files that conform to a rigid schema (specifically this one). All we want to do is create 1-to-1 data mappings between several database tables and the XML file, so we can set up a trigger on the table where our web service software package inserts the file, then automatically parses ...

xml Column update and Locking in Sql Server

Hi, I have a few windwos services. They get xml column from Sql server manipulate and update it. Service A- Gets XML Service B- Gets XML Service A- Updates XML (it will be lost) Service B- Updates XML I must lock row and I use next Code: SqlCommand cmdUpdate = new SqlCommand(); cmdUpdate.CommandText = "select MyXML from M...