But I am getting following error using the above Stored procedure
Server: Msg 5105, Level 16, State 4, Line 1
Device activation error. The physical file name 'c:\mssql7\data\pubs.mdf' may be incorrect.
But the physical path is correct.I also tried with
sp_attach_single_file_db but same error results.
How can i do the same using Enterprise Manager,It will be highly appreciated if u tell me step by step.
Are you using SQL Server 7? I can explain how I do it with 2000, but I assume it would be similar process.
Open Enterprise Manager.
Expand the tree until you find your database server instance. Expand that.
Right-click on Databases, select All Tasks -> Attach Database.
Browse [...] for your database file.
As for the error you are receiving, I don't know what the problem might be.
Was the file detached from the original database, or just copied? That may cause problems potentially. But I'm no DBA, so I can't say for sure.
How can I create a textual dump of a SQL Server 7 database? I have used MySQL and it provides a feature to take a textual dump, with either structure or structure plus data. So if I want to create the same database elsewhere I can use the DDl statements in the dump to create the same tables.
There are other ways to transfer DB's in SQL server. But I'd like to know if SQL Server supports textual dumps or not. This is mainly for me to transfer a DB in SQL Server 7 in a remote offline system to a SQL server 6 in another system. The export-transfer-import mechanism fails somehow
It is better to be hated for what you are than to be loved for what you are not.
-- Andre Gide
Well, I understand that you use ADO to insert the new record. The following code is stripped from VB code generated by the data form wizard in VB (with some changes), if you look at the code you'll find that no value was entered for the AutoNumber field, so I assume that if you use the INSERT command without specifying a value for the AutoNumber field it should work too (try it on your own).
There is an AutoNumber field customer_id which doesn't appear in the code, the value of that field is assigned automatically.
' ASSUMING YOU ALREADY HAVE A CONNECTION OBJECT db
Dim strSQLQuery As String
strSQLQuery = "SELECT Customer.* FROM Customer"
Set tblCustomer = New ADODB.Recordset
tblCustomer.Open strSQLQuery, db, adOpenStatic, adLockOptimistic
Here's my situation. I know nothing about database programming. I know lots about C++ and MFC and I use Visual C++ 6.0 but also have VS.NET 7.0. Someone has given me a machine with SQL Server and database on it. The database is not very big, maybe 1000 records. I want to get the database off the machine and I want to write an MFC application that will access the data and display it. I want to ship the application and I don't want people to have to have SQL or install anything extra to use the application. I'm sort of hoping that I can convert the database to some sort of file (maybe Access) and query it from MFC. The application would ship with the data and all reading and querying from the file would be local to the machine that the application is installed on.
How would people get started with this and does anyone have any ideas on how to proceed.
with such few records you can as well export the data in some sort of flat-file (e.g CSV). Read the file at program start-up into memory as a balanced tree or double-linked list or into a list-control.
Whenever you use some sort of database, you got to deal with a lot of prerequisites (is the proper version of MDAC / ODBC etc. installed?), so this aproach should be easier.
I'm querying an MS Access database table from an ASP page using ADO. My query returns a number of fields per row. The last few fields are null when I access them from the ASP page, even though in the database they are not.
I'm guessing that this is because:
1) the data in all the fields combined exceeds the row's buffer size.
2)the number of fields exceeds the maximum # allowed(unlikely, but possible)
Is one of these correct, and if so, is there any way to either (1) increase buffer size or (2) increase max # of fields?
Note: I have tried re-ordering the fields and always the last few fields are null but no others.
MSDE supports only windows authentication, and does not support SQL Server authentication (user/password you passes in the connection string). As your ASP.NET page runs inside aspnet_wp.exe process, which runs under YOUR_DOMAIN\ASPNET account, you must grant it access to your database (either from osql.exe tool or from the EM).
Also, you misspelled the "database" key ("databaes").
My problem is that I get an error when I try to get data from an empty field in a record. In my table I have FirstName, LastName and PhoneNumber. It's not necessary to put a value into PhoneNumber. So when I try to get the data, I have "invalide data type" error. All my data are CString type.
So I supposed that ADO cannot change something "empty" to CString...
Everything's beautiful if you look at it long enough...
Everything's beautiful if you look at it long enough...
I'm looking at storing text in a MS Access database, but the amount of text may very easily exceed the 64k restriction on the "memo" data type. What would be the best way of implementing this? Yes, I know I could store the data in a text file and place a filename in the database, but I'd rather keep it all in the database if possible.
Any help would be greatly appreciated
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
I have table (in sql server database) which contains two fields ,Name(varchar) and Date_of_Birth(Datetime)
I want to fetch those records whose birth day is in this week (incuding today(system date)).
Please help me with the query
thats nice ,but i want only those date of birth which is between today and 7 days after today(not before).
for example today date is 4/1/2003
i want to fetch those date of birth which is today and 7 days from today i.e
the records should be like below()
pradipta wrote: but i want only those date of birth which is between today and 7 days after today(not before).
SELECT t.Name <br/>
FROM MyTable AS t <br/>
WHERE t.Date_of_Birth between GETDATE() AND DATEADD(d, 7, GETDATE())
You might need to manipulate this a bit. It will return exactly 7 days (7 days * 24 hours). The time element may throw the query off. For example, if the current system date/time is 04/02/2002 13:00:00 then a birthday with the following will not appear: 04/02/2002 1:00:00 and 04/02/2002 00:00:00.
i think U did not understand the problem.the query u have written only to retrive those DOB which will lie within this week.But DOB means only the month and day will be same whatever may be the year ,for exammple today is 4/4/2003 and DOB of a member 4/4/1975 then today is the birth day of that memeber.
so i want only the dob from database whose day and month will be equal to today's day and month and also those whose b'day will be within 7 days beyond today
just see the example
dob in the data base
Today is -4/4/2003
i want the the data from database
because the above dobs will lie on this week