I have query that work for me only when values in the StakeValue don't repeat.
Basically, I need to select maximum values from SI_STAKES table with their relations from two other tables grouped by internal type.
SELECT a.StakeValue, b.[StakeName], c.[ProviderName]
FROM SI_STAKES AS a
INNER JOIN SI_STAKESTYPES AS b ON a.[StakeTypeID] ...
For the database in my project I have a drop/create script for the database, a script for creating tables and SPs and an Access 2003 .mdb file with some exported values.
To set up the database from scratch I can use my SQL management studio to first run one script, then the other and lastly manually run the sort of tedious import task.
...
Right now, to see the code of an existent stored procedure I have to RightClick -> Modify it, is there a way for me to just see the code?
...
CREATE TABLE [dbo].[INVS_ITEM_LOCATIONS]
([DEPARTMENT_CODE] [varchar](3) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[IM_INV_NO] [numeric](10, 0) NOT NULL,
[LOCATION_CODE] [varchar](2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CURR_QTY] [numeric](10, 0) NOT NULL CONSTRAINT [DF__INVS_ITEM__CURR___1352D76D] DEFAULT ((0)),
[DO...
I'm trying to update an XML column in a SQL Server 2005 table. Access to this column is through a stored procedure. I'm using a .NET tableAdapter to call this procedure.
The problem: The value of the xml column does not get updated.
Some observations:
I used SqlProfiler to see if the stored procedure call is actually sent to the SQL S...
Hi,
I am trying to download a file I have uploaded to an image field in my MS-SQL database. The problem is that when I try to open the file it just says System.Byte[] instead of containing the actual content.
UploadFiles is my class which contains the filename, id, filedata etc.
public void DownloadUploadedFile(Page sender, UploadFiles...
I would like to update the top 400 rows in a database table. The pseudo SQL is below, how can I do this?
UPDATE top (400) db.dbo.tbl
SET column1 = 2
WHERE column2 = 1
AND column1 is null
...
I have replication set up between a sql-server 2005 instance and multiple sql-server 2000 instances. The replication will successfully for a while before I get the following error message:
Violation of UNIQUE KEY constraint 'unique_pubsrvdb'. Cannot insert duplicate key in object 'dbo.sysmergesubscriptions'. (Source: MSSQLSERVER, Erro...
What is the most efficient way to write a select statement similar to the below.
SELECT *
FROM Orders
WHERE Orders.Order_ID not in (Select Order_ID FROM HeldOrders)
The gist is you want the records from one table when the item is not in another table.
...
Hi guys,
As you might have guessed from the title, I'm really new to analysis services. I've spent the last 5 hours (crazy!) just trying to figure out what is the difference between the analysis services avail. through SSMS and business intelligence development studio avail. through visual studio?
Thanks
...
Just wondering if the microsoft sql 2005 database tuning advisor takes into account the number of inserts performed on a table the the cost of adding subsequent indexes to that table?
...
I am working on a database that has an existing Individuals table that every user type derives from. In other words, there are tables like:
Individual: FirstName, LastName, Email, <lots more>
Employee: IndividualId
Customer: IndividualId
etc.
Now, I want to add new type of user (WeirdPerson) that does not derive from Individual....
I'm having a serious problem with one of my production databases.
The database was enabled for change data capture which was performing quite well. Last month we had a server meltdown where several disks were affected and data was lost. We then recoverd the database backups from tapes and restored them on the freshly installed database ...
I have built a T-SQL query like this:
DECLARE @search nvarchar(1000) = 'FORMSOF(INFLECTIONAL,hills) AND FORMSOF(INFLECTIONAL,print) AND FORMSOF(INFLECTIONAL,emergency)'
SELECT * FROM Tickets
WHERE ID IN (
-- unioned subqueries using CONTAINSTABLE
...
)
The GUI for this search wi...
Is there a relatively easy way to find an instance of a character, say a "|" or a "~" or a "&", in a database?
It could be in any field...in any table.
There are around 400 to 500 tables in the database in total.
...
I am using SQL Server 2008 Full Text capabilities for the first time. I like the features that CONTAINS and CONTAINSTABLE offer, but I don't expect my users to learn the syntax for looking for inflections, using phrases, proximity, etc.
My GUI will have a single text box to search with. Is there anything (.net DLL or c# code) out there ...
I’ve two issues that I was hoping for some insight on and/or some appropriate links or Google terms to use to find more information on as I’m not finding anything. It boils down to the fact that I would like to find out when/how an IQueryable expression that is going to be executed determines that some of the expression result needs to ...
I am planning to migrate a large database table from our main SQL database to a separate one. Because it's a high volume/one time process, I'm going to use SSIS. Does anyone know how best to time migrating all the data and changing the code's connection string?
Quick background: Our system uses a table to log every notification that i...
MSSQL has an interesting JDBC inconsistency. Regarding the parameters on a stored procedure, when you access their names, they are referenced with an @ sign in front of them (the way they are declared in the stored procedure).
When you use a callable statement to set parameters by name, however the Microsoft JDBC driver requires you to ...
Recently one of our client's websites fell prey to a SQL Injection attack due to a failure to sanitize query string parameters provided to the page. The vulnerable code has since been identified and is being corrected, but it got me wondering about some of the differences between how MySQL and SQL Server process multi-query strings.
The...