sql-server

How to insert multiple records from Vb.net to SQL Server 2005 table ?

I have 40000 records in my DataTable. I want to insert all the records into SQL Server. I am using vb.net 2008 and SQL Server 2005. Currently I am using XML to pass from vb.net to SQL Server 2005 but it will give me network error. Is there any other way I can achieve this ? ...

Write a sql to get the last data

Hello everyone, I have a Realtime table with example data: Symbol Date Value ABC 1/3/2009 03:05:01 327 -- is last data for 'ABC' ABC 1/2/2009 03:05:01 326 ABC 1/2/2009 02:05:01 323 ABC 1/2/2009 01:05:01 313 BBC 1/3/2009 03:05:01 458 -- is last data for 'BBC' BBC 1/2/2009 03:05:01 ...

Consolidate information held in a number of SQL Server Express Instances

Hi, I'm trying to determine the best architecture for creating an oData web service for information held in a number of SQL Server Express instances. The web service should provide a consolidated view of the data. All the SQL Server Express instances have the same DB schema. I was initially planning to use SQL server replication however ...

Getting the most recent entry per group in a select statement

I have 3 tables to join to get table1.code, table1.series, table2.entry_date, table3.title1 and I'm trying to get the most recent non null table3.title1 grouped by table1.code and table1.series. select table1.code, table1.series, max(table2.entry_date), table3.Title1 from table3 INNER JOIN table2 ON table3.ID = table2....

strange SQL Server attach database error

Hello everyone, I am using SQL Server 2008 Enterprise with VSTS 2008, and I am developing a simple web application using ASP.Net and Forms Authentication. When I am using the configuration tool/menu of VSTS of my ASP.Net project (I want to use this tool to manually add some Forms authentication users), I met with the following error (S...

Cluster-aware client app (to SQL Server)

Hello, We have an .NET client app working against SQL Server 2005 (clustered), do I need to do something special in the client app to make it cluster aware? Thanks. ...

How to add data to sql but for one id and more than one data ?

i have one id and more filepaths.forexample: id:123456 FilePath: C:/a.jpg C:/b.jpg C:/c.jpg C:/d.jpg C:/e.jpg Result must be: 123456|C:/a.jpg 123456|C:/b.jpg 123456|C:/c.jpg 123456|C:/d.jpg 123456|C:/e.jpg How can i add more than one path for one id But My result is : 123456|C:/e.jpg i need others public bool AddDCMPath2(...

SQL JOIN with two or more tables as output - most efficient way?

I have an SQL query that executes a LEFT JOIN on another table, then outputs all results that could be coupled into a designated table. I then have a second SQL query that executes the LEFT JOIN again, then outputs the results that could not be coupled to a designated table. In code, this is something like: INSERT INTO coupledrecords SE...

Update/Insert SQL Server database table

Hi, I have a program written in C# with a SQL Server database. In the database there is a table (ProcessData) with 3 columns: ID (PK, auto-ID), Start (DateTime), End (DateTime). There are also a lot of threads which will be inserting new rows into the database table (ProcessData) every few minutes/seconds. I want to insert at the...

again new query. i am trying to solve this from one hour. please help

Query : List the film title and the leading actor for all of 'Julie Andrews' films. there are three tables movie (id, title, yr, score, votes, director) actor (id, name) casting (movieid, actorid, ord) select movie.title,actor.name as cont from movie join casting on (movie.id=casting.movieid) join actor on (casting.acto...

SQL Server 2005 Copy Database Wizard keeps failing

Hi, I am just trying to copy a database from one server to another one... on the same domain. I use the Copy DB Wizard and set up everything correctly but it keeps failing. Is something wrong with the Wizard or just me missing something? ...

TSQL Help (SQL Server 2005)

I have been playing around with a quite complex SQL Statement for a few days, and have gotten most of it working correctly. I am having trouble with one last part, and was wondering if anyone could shed some light on the issue, as I have no idea why it isnt working: INSERT INTO ExistingClientsAccounts_IMPORT SELECT DISTINCT cca.Accoun...

cant start SSIS service on sql server 2008

Hello, In Sql Server Configuration Manager I Sql Server Integration Services has status stopped, when I try to start it aftger few seconds there is an error message: The request failed or the server did not respond in a timely fashion. Where the problme can be ? ...

IDENTITY_INSERT ON inside of cursor does not allow inserted id

I am trying to set some id's for a bunch of rows in a database where the id column is an identity. I've created a cursor to loop through the rows and update the ids with incrementing negative numbers (-1,-2,-3 etc). When I updated just one row turning on the IDENTITY_INSERT it worked fine but as soon as I try and use it in a cursor, it...

Add multiple columns in select query

Scenario is like: SomeTable { A int, B int, C int } I need to select and add with formula: A + 25%B + 50%C. If in decimal, round upto next full digit and display an asterisk and a spcae preciding the sum. Each column needs to be rounded off before adding. Suppose data is 10 16 12 14 15 19 Select should return: 20, 28 *. I am thin...

Database design

Hello, I've a system, that have two types of users (Companies and individuals).all types have a shared set of properties but they differ in another. What is the best design merge all in one table that allows null for unmatched properties, or separate them in two tables related to a basic table with a one to one relationship. Thanks. ...

SQL Server 2008 - Query takes forever to finish even though work is actually done

Running the following simple query in SSMS: UPDATE tblEntityAddress SET strPostCode= REPLACE(strPostCode,' ','') The update to the data (at least in memory) is complete in under a minute. I verified this by performing another query with transaction isolation level read uncommitted. The update query, however, continues to run for anot...

Amazon EC2 Instance - How to find SQL Server Password

Hi I have created an Amazon EC2 Instance that provides Windows Server 2008 with SQL Sever 2008 pre-installed. Now in order to use the SQL Server for creating databases, or restoring backups of the databases that I have on my local machine, I need the "sa" password for SQL Server 2008. I have tried using the following but with no luck: ...

Recovering from database downtime with streaming data

Hi, I have a situation where I receive a continuous stream of data. This data gets processed and transferred into a database (SQL Server). Now, I'm trying to code a model where if the db is down, the data is 'saved' locally (say in a file) -- and flushed out to the db when it recovers. I was wondering if there are any existing better ...

Optimal way to convert to date

I have legacy system where all date fields are maintained in YMD format. Example: 20101123 this is date: 11/23/2010 I'm looking for most optimal way to convert from number to date field. Here is what I came up with: declare @ymd int set @ymd = 20101122 select @ymd, convert(datetime, cast(@ymd as varchar(100)), 112) This is prett...