I have a table that describes a hierarchy:
Name MemberName
A B
A C
B D
D E
F G
MemberName references the Name column of the same table. From this table, I can easily query to see that B and C are members within A, D is a member of B, E is a member of D and G is a member of F.
Based on this structur...
I have three SQL Server databases on one SQL Server instance. Every time I do query to different databases, I have to select the database.
Is there a way to do query without database select. Like this:
SELECT * FROM database_name.table_name WHERE id = 1
...
hi,
i have windows 7 64 bit. I have installed SQL Server 2005 32 bit in it. it installed properly but the native clients says its not proper or compatible to run in x64 mode.My question: Where can i get native client that can be run on 64 bit OR Is SQL Server 2005 there for 64 bit?
Thanks
...
This is I think a simple problem but not getting the solution yet. I would like to get the valid numbers only from a column as explained here.
Lets say we have a varchar column with following values
ABC
Italy
Apple
234.62
2:234:43:22
France
6435.23
2
Lions
Here the problem is to select numbers only
select * from tbl where answer li...
Using SQL Server 2005
I have two table which have the same datatype and datasize, same data's
When i execute my query, I got the result in one table, when i execute the another table i got this error as string or binary data would be truncated error, i checked the datatype size also. Before it was running, am getting this error from tw...
Given the query below there might be multiple rows in dps_markers with the same marker key but we only want to join against the first. If I take this query and remove the top 1 and ORDER BY I get a value for mbg.marker_value but run as it is it always returns null
SELECT u.id, mbg.marker_value
FROM dps_user u
LEFT JOIN
(SELECT TO...
I have a problem where I need to get the earliest date value from a table grouped by a column, but sequentially grouped.
Here is a sample table:
if object_id('tempdb..#tmp') is NOT null
DROP TABLE #tmp
CREATE TABLE #tmp
(
UserID BIGINT NOT NULL,
JobCodeID BIGINT NOT NULL,
LastEffectiveDate ...
I have two procedures - two huge sets of selects with several sub-select and unions.
I need to union results from these procedures and I still need them to exists separately.
Something like that:
if @Param = 1 Then
PROCEDURE1
if @Param = 2 THEN
PROCEDURE2
if @Param = 3 Then
PROCEDURE1 union PROCEDURE2
I read that it's i...
I'm an experienced Sybase developer (10+ years) looking to branch out into SQLServer. Does anyone have any advice on good courses / books to help me transition? Thanks.
...
i have this table of comments (little over 1 milion rows) that gets around 10.000 inserts and around 100.000 queries against it every day, and minor deletions and updates. the query that gets the comments causes performance issues that sometimes it locks up entire database and i am getting a lot of timeouts. please help me adjust my inde...
I've got a website that runs on a shared hosting environment, using ASP.net 2.0 (C#) and MS SQL Server 2005. I've recently been asked if I can integrate my website with a piece of third party desktop software that uses the Access runtime as its database (transparent to the end user).
Primarily I want to be able to offer users of my web...
I am trying to build a query, but I am having some difficulty.
I have a SQL Server 2008 database with a table that includes, among other fields, a geography field that describes road segments. (This data has been imported from TIGER/Line data from the U.S. Census.)
I have another fixed point describing a user's location. I want to find...
I have to do this thing for work that's really just a formality. Normally I'm a linux/UNIX guy but they're making me do this. I need to have an asp webpage that displays data from two different database servers. This is easy -- just a drag and drop in visual studio. The problem is I also need a way to insert a new row into a table on the...
Hi,
I'm building a website using ASP.NET and SQL Server, and I use
SELECT PK FROM Table WHERE PK = @@identity
My question is which is better and more reliable to retrieve the last inserted PK for multiuser website, using @@identity or using this:
SELECT MAX(PK) FROM Table WHERE PK = Session ("UserID")
...
Hi,
Hi have a stored proc that always returns a single row depending of a parameter:
IF @bleh = 1
SELECT TOP 1 Xyz FROM Abc
ELSE
SELECT TOP 1 Def FROM Abc
I must use SqlMetal to generate the DataContext but this stored procedure returns a IMultipleResults, which is an error. Instead it should return a ISingleResult...
If I remov...
This may be a really dumb question, but...
What units does Geography.STLength return? The official MSDN page doesn't say anything about the units returned, and this blog entry here says STLength() returns a float indicating the length of the instance in units. Yes, that's right, it says it returns it in units.
Can anyone shed some ligh...
I am having a table like this
ColumnId Intime Outtime
1 01/02/2009 10.00.000 01/02/2009 20.00.0000
2 01/02/2009 2.00.000 01/02/2009 2.00.0000
3 01/02/2009 2.00.000 01/02/2009 5.00.0000
4 01/02/2009 3.3.0.000 01/02/2009 5.00.0000
5 01/02/2009 10.00.000 01/02/2009 22...
Hi,
I am using SQL Server 2008 R2. Is there a free script/utility which can make CRUD SPs for all of my database tables? I use to have one but lost the script.
Thanks
...
Is there a way to search through the set of (Stored Procedures, Functions, Views) for the usage of a constant?
I have a problem where I've got a sql server database. It has quite a few stored procedures and functions declared. I'm looking for the usage of "115", which happens to be a pay code. I didn't write all of the code origina...
If I have the name of a field is there away to know (lookup?) whether this is a PK and if so in which table?
...