Hi,
I have the following table
custid ordid qty datesold
1 A2 12 2008-01-05
2 A5 5 2008-01-02
1 A1 5 2008-01-01
2 A7 3 2007-02-05
What't the best way of getting the previous order for every customer?
Thanks
...
It is connected to BI and merging of data from different data sources and would make that process more smooth.
And is there an optimal migration strategy from a database without Guids to a version with Guids without information losses?
...
I dropped a database from SQL Server, however it turns out that my login was set to use the dropped database as its default. I can connect to SQL Server Management Studio by using the 'options' button in the connection dialog and selecting 'master' as the database to connect to. However when ever I try to do anything in object explorer i...
I've read all the posts about prefixing the numbers with ', and setting IMEX=1 in the connection string; nothing seems to do the trick for me.
Here's the setup: Excel column with mixed data - 99% numbers (some start with 0) 1% text.
PROGRAMATICALLY mporting into SQL Server 2005 table / column type - varchar(255).
Import works fine lo...
Is there any possibility to directly dive into SQL Server stored procedures from .net code?
So when debugging step by step in .net, I'd like to step into a called stored procedure.
I know how to debug them individually, but I'd like to join these debug sessions in order to gain some time.
...
I have a sql statement that consists of multiple SELECT statements. I want to limit the total number of rows coming back to let's say 1000 rows. I thought that using the SET ROWCOUNT 1000 directive would do this...but it does not. For example:
SET ROWCOUNT 1000
select orderId from TableA
select name from TableB
My initial thought wa...
I'm writing a database application that connects to SQL server. I'd like to implement a similar connection dialog box like the one in SQL Management Studio. I've already found a way to get the list of databases on a server, but I'd really like to get the list of available servers on the network so end users won't have to type in the name...
Normally it just puts multiline content on a one liner field and adds slightly smaller than normal tabs between text where the line breaks would normally be.
I am using SQL Management Studio Express.
...
Due to the packaged nature of the release, a SQL Server script (well more of a statement) needs to be created that can execute correctly on SQL Server 7.0 thru 2008 which can essentially achieve this:
if exists(select * from sys.databases where name = 'Blah')
Reasons this is difficult.
SQL 7 'sys.databases' is not valid
SQL 2008 'sys...
I have a table for which I want to select top the 5 rows by some column A. I also want to have a 6th row titled 'Other' which sums the values in column A for all but the top 5 rows.
Is there an easy way to do this? I'm starting with:
select top 5
columnB, columnA
from
someTable t
order by
columnA desc
...
At work we recently upgraded from Microsoft SQL Server 7 to SQL 2005. The database engine is a lot more advanced, but the management studio is pretty awful in a number of ways. Most of our developers decided they preferred to stick with the old Query Analyzer tool, even though it had a lot of limitations.
In my spare time, I decided t...
I have two tables one has a three column composite key. The other needs to reference this composite key.
What is the syntax for creating a foreign key which references multiple columns.
I tried googleing, but I couldn't find it.
...
I want to gather data from different data servers located in Europe and Asia. Rather than running a plain data query task that will clog up the undersea network I am thinking of a couple of machines that will be available for me at the local sites.
I am thinking to design the master package so that I can:
run remote setup tasks
launch...
Is there a way to determine when a sql agent job as finished once it has been started with sp_start_job?
...
We're planning a browser application (xbap) which is going to talk to WCF services. These WCF services get information from a SQL database. Each of our clients has his own database on this server. The clients need to get reports from SQL Reporting Services. A client can have multiple instances of this application running.
How does this ...
We currently send an email notification in plain text or html format. Our environment is C#/.NET/SQL Server.
I'd like to know if anyone recommends a particular solution. I see two ways of doing this:
dynamically convert current email to pdf using a third party library and sending the pdf as an attachment
or
use SSRS to allow us...
Background:
I'm writing a data provider that SSAS will use to get data from a third-party system.
I wrote a tool that will build cubes, dimensions, measure groups and measures based on the configuration of the third-party system using AMO.
Now, in the Cube Browser, I am able to pull the members of the dimensions, however, measure data ...
I've got some data files that are stored compressed on our company's server with a .Z extension (UNIX compress utility used to zip them down).
Can SQL Server's BULK IMPORT operation read these files in that format? Or must I uncompress them before getting at the data?
...
I've been developing a winforms app tied to sql server. I haven't rebooted in a while. Today i rebooted and now I can't log into sql. I used every account I know and their passwords including one that was working just before i rebooted and i get a 'Login failed' . I did take the database I use offline just before starting and I do have b...
Hi folks,
I've got a column in a table (eg. UserName) which I want to make sure is unique. So I create a unique key for that column and call it IX_Users_UserName.
Now, if I do lots of searching for users based on their username I want to make sure there is an index for that field.
Do I need to create a separate index, or is the unique...