Hi--
I routinely create constraints in my database tables, e.g., EndDate >= StartDate, etc. But I don't know of a way to create a constraint that works across tables. For example, let's say I have a 1:Many relationship between these two tables:
Admission(AdmitID (PK), AdmitDate,...)...
Is there a way to create a virtual table in a stored procedure that holds the results of a call to another stored procedure?
In other words, say I have sp1. Can I do something like this in sp2:
VirtualTable = EXEC(sp1 param1, param2)
SELECT<field list>
FROM VirtualTable
If so, what is the...
Hi,
I have a table with a column called AdmitDate and I need to know how many rows in that table have AdmitDates that are within 30 days of the AdmitDate of the previous row. I'm stumped about how to write such a query, or if it is even possible to do so. Can anyone please help?
thanks
Hi,
I'm trying to create a query in a database on one SQL Server that refers to a database on another SQL server. Even though the other Server is listed properly under "Security/Linked Servers," and all user permissions are correct, when I try to save the query, I get this error:
"Error 7405...
Hi--
I've got the following sp (not sure how to demark code in this forum):
=======================================================
CREATE PROCEDURE dbo.UP_Get_Program
@PACEId INT
AS
DECLARE
@Program VARCHAR(7)
SET @Program = (SELECT Program FROM...
Well, thanks for the reply, anyway! I'm trying to figure out why that would not be allowed. If a database is a model of a miniworld, and a miniworld can relate to other miniworlds, you'd think that something like this should be allowed... Another way of looking at it is that miniworlds are just...
How, if it is possible, does one set up a foreign key in one table to point to a primary key in a table that's in another database (same server)?
Thanks.
When you use an OR, will SQL Server evaluate the left part before it determines it is necessary to evaluate the right part? You know what I mean? For example:
a = 1 or b = 2
If a = 1, it's not necessary to evaluate the b = 2 part. Is SQL Server smart enough to figure this kind of thing out...
Thanks. It doesn't want to open it when I double-click on it, and judging by the icon, the file does not seem to have an association. When I open it in a text editor or Explorer, tt seems to be an XML file. How do you open it to view it properly?
Thanks, again.
Hi,
How do I refer to a database on a different SQL Server from inside a view or stored procedure? Both servers are registered in MMC (or Enterprise Manager).
Thank you!
Does anyone know of a way to get the date and time that a view was last changed? I've tried looking in the sysobjects table, but it doesn't seem to be there...
Thanks
Hi--
I need to update all rows in a table that have a date in a datetime field that comes after a certain date. I'm not sure how to write that.
...
WHERE DateTimeColumn >= '9/1/2005'
I must need to convert the string value at the end of this WHERE clause to an actual datetime? Can someone...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.