Please asssit on this foxpro to sql server migration requirement..
I have this function USED() in foxpro which determines if a table is open in a work area. Is there any such function in SQL Server that does the same job?
Please asssit on this foxpro to sql server migration requirement..
I have this function USED() in foxpro which determines if a table is open in a work area. Is there any such function in SQL Server that does the same job?
I moved from Foxpro to SQL ages ago. Quick rundown of how it works in SQL Server:
USE
command. Examples follow.Say my login has access to two databases, TestA and TestB. Both databases contain table MyData, and each table contains different data (A data and B data). When I log in, my context gets set to one database, lets say TestA. If I run SELECT * from MyData
, I will get the contents of that table from database TestA. If I wanted to get the data from TestB, I would either have to run SELECT * from TestB.dbo.MyDta
-- specifying the database I'm gettng the data from -- or I'd have to change the context of the database; programatically, this is done with the Use command, e.g. `USE TestB'.
This is a very simplistic description of "how it works". It's all programming, which means there are dozens of way to perform a given action, depending on the tools (applications) you are using and tasks you seek to achive. I strongly recommend reading up on, well, everything in SQL Books Online, the documentation that comes with SQL Server -- Microsoft did a very good job documenting this product.
Philip is correct about everything being "open" in SQL. However, I think I would express it a little differently. When SQL-Server is running (since it's typically an automated service that starts when the server itself starts), ANY "database" that has been "attached" is available to query from and is basically untouchable from the OS anywhere else because SQL has an open "handle" to the file, thus preventing copying, deleting, moving, etc...
If you did want to copy/move to other location or even another server, you would have to detach the "database" which releases the handle and you can do whatever.
As for what you can do in SQL-Server. You don't even have to open the database explicitly but can qualify your queries by database.table reference... such as
select t1.field
from YourDatabase.SomeTable t1
where t1.SomeField = ?whatever
As long as the database is attached, you should be good to go.
SELECT tablename
SET ORDER TO tablename.name ELSE
USE tablename IN 0 ORDER name
ENDIF – rock Jun 15 '12 at 13:28