I have a string which contains a comma delimited list of id's which I want to use in a where clause.
How can I achieve this? Essentially I have:
set @ids = '5,8,14,5324,'
SELECT * FROM theTable WHERE Id IN (@ids)
but @ids is a varchar and Id is an int.
Any ideas much appreciated.
...
Hi
I am not sure if the transaction log is what I need or what.
My first problem is that I have a stored procedure that inserts some rows. I was just checking out elmah and I see that some sql exceptions happens. They all are the same error(a PK constraint was violated).
Other than that elmah is not telling me much more. So I don't k...
I am more than a little confused with an issue I have encountered 3 times in the past 2-3 months. The title of this question outlines the issue, but for more detail:
I have an SP which always returns results without issue when executed through SQL Server Mgmt. Studio, however very rarely (but enough to cause major headaches)- it will si...
In SQL Server 2005 what column type should I use to store a LatLng Coordinate?
For example a Lat coordinate like 135.0058554
I know there are new types in SQL Server 2008 but I'm stuck with SQL Server 2005 for the time being.
thanks
...
Hi,
I have this scenario in my Spring MVC Apps.
User has to choose what hobbies he/she likes. He can choose at least one or many hobbies.
My problem is this, If I need to save the list of hobbies into my DB, I am thinking of sending the list of hobbies that my user has chosen, delimited by a comma separator.
Its like this: Baskteba...
Hi, suddenly we have to save kanji (Japanese) in a couple of columns of two or three tables.
I have tried to save to the db using the current collation which is SQL_Latin1_General_CP1_CI_AS.
However, I just get '?' for each character. I am going to need to change the collation to Japanese_CI_AS I presume.
My question is can I change the ...
i have one table sql server like below , from that table i want to get quesno, field name[what are the field have value]
QuesNo A B C D
1 1 0 1 0
2 0 0 0 1
Output :
QuesNo Result
1 A,C
2 D
Is there any possible ways to get outpu?
...
warning -- This program has known compatiblity issues.
It shows me a warning message when i installing SQL SERVER 2005 or Visual Studio 2005 on my machine which is Win7 Ultimate 32 Bit it said Windows has a compatibility issue with Sql server2005 kindly install sql server service pack 3 or later on that machine. And when i installing vi...
I was just wondering which approach is better.
Creating a complex select query with many CASE WHEN THEN ... ELSE ... END statements or sub queries in select clause.
Create a temp table and then insert and update it. Finally select * from @tempTable
This question is only for complex queries not for simple joins or just when some smal...
What I am trying to do is take multiple rows of data from a column and insert it into a single cell. Here's what I have below:
+++HouseNumber+++++++CustomerType+++
+ 1 + Residential +
+ 2 + Commercial +
+ 2 + Residential +
+ 3 + Residential +
+++++++++++++++++++++++++...
I'm facing conflicts between SQL BI tools of different versions (2005 and 2008). I have SQL BI tools 2008 installed on my PC and when I'm trying to install SQL BI tools 2005 (trying to do this because the part of the project I'm working on is written on VS 2005 and SQL 2005) and it says that i have a later version of the BI component and...
I have 3 tables (simplified):
tblOrder(OrderId INT)
tblVariety(VarietyId INT,Stock INT)
tblOrderItem(OrderId,VarietyId,Quantity INT)
If I place an order, I drop the stock level using this:
UPDATE tblVariety
SET tblVariety.Stock = tblVariety.Stock - tblOrderItem.Quantity
FROM tblVariety
INNER JOIN tblOrderItem ON tblVar...
I've been having a debate of sorts with a co-worker who suggested that we allow some cpu intensive processes in our enterprise to poll CPU usage and execute their tasks when the CPU usage is low. My counter-point was that while cpu usage in an ideal system would denote the level of system activity on a given server, in actuality it has ...
Reporting Services was working fine until recently, now when I try to deploy and run a report from Business Intelligence Studio I get this error.
Similarly when I try to connect to the ReportServer URL directoy from IE Explorer, (set to http:///ReportServer I get the same error, so it's not specific to the report but probably rather to...
My first post here, please be gentle. =)
I work for a company that inherited the maintenance of a bespoke system used by one of our customers. The previous developer (no longer with us) encrypted all the database objects (WITH ENCRYPTION).
The system has been plagued with various timeout issues well before we took ownership of it, and ...
For the sake of example, I have a table with columns A B C D E F G H.
I have created two indexes on the table that correspond to the most used queries. The first is on columns B C D and E. The second is on B C D E and F.
The queries that use these columns are called the same number of times and they are each optimized with respect to...
How would I go about updating existing DateTime columns in an update statement?
I'd like to subtract one day but I get an error message saying that I cannot use DateAdd in an update (something about an overflow).
I came up with this query but of course it will not execute.
begin tran upd
update answer
set SentForApprovalAt = Date...
I am trying to create a view that pulls a particular record. The problem I am running into is that there are 2 records to choose from and a status flag that is either 1 or 2. It should pull the 1 record if it exists, and if not the 2 record.
Is this possible from a view?
...
I have a table:
Series
========
ID
SeriesName
ParentSeriesID
A series can be a "root" series, (ParentSeriesID is 0 or null) or it can have a Parent. A series can also be several levels down, i.e. its Parent has a Parent, which has a Parent, etc.
How can I query the table to get a Series by it's ID and ALL descendant Series' ?
So...
Hi,
I have successfully created linked server between 2005 and 2008 version. We changed a table schema on 2008 and re ordered the table columns. We also did the same on 2005 server.
If we query both table in their own database then schema looks fine however
when I do
SELECT * FROM and Select * from then it is showing me old schema ...