|
You could also detach the database and then copy the mdf and ldf files over to the new machine. You will have to reattach the files on the main machine and the laptop. The whole point of detach and reattach is to provide a means to share databases and it is allot simpler than backing up and restore method.
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
Aaron VanWieren wrote: The whole point of detach and reattach is to provide a means to share databases
Move, not share.
The whole point of a server based database system is that you don't end up with multiple copies of a database and end up with a complete mess because you no longer know which is the definitive version. This happens a lot with Access.
Aaron VanWieren wrote: it is allot simpler than backing up and restore method
Well, with backup and restore you only have one file to deal with. With detach and attach you have to deal with a minimum of two files and, depending on how your database is set up, it could be a lot more than that. Not only that but the database could span various disks. Heck, it is even possible that SQL Server just takes over an entire disk - so there are no files to detach at all, just a physical disk.
|
|
|
|
|
Good points. Sorry in the over simplification. It really depends on the database specifics.
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
When you post a question like this, you need to provide more information than this. For instance, which database are you using? This does play an important part in answering this question.
If you are using SQL Server 2005, you can use a Common Table Expression (CTE) to solve this problem. There are many examples that you can use for this.
In earlier versions of SQL Server, you will need to do some real hacking at code.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: When you post a question like this, you need to provide more information than this.
Looks like he didn't want to provide more information.
|
|
|
|
|
Colin Angus Mackay wrote: Looks like he didn't want to provide more information.
Looks like it. Probably homework and the teacher's looked in.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Using ADOX (in C# form application) to update a Jet 4.0 database
Supposedly I should be able to change a column’s REQUIRED property by using this code:
cat.Tables["Products"].Columns["ItemReorderDate"].Properties["Nullable"].Value = true;
Found at:
http://msdn2.microsoft.com/en-us/library/aa140022(office.10).aspx
Unfortunately, it gives this error:
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
Is ADOX “Nullable” not compatible with Jet 4.0?
If not, is it possible to change the REQUIRED property to "NO" by a SQL command for Jet 4.0?
Thanks,
Ron
|
|
|
|
|
Hi,
I'm tired of searching a way to save and load an image from a SQL Server 2005 database.
There are lots of examples that explains that, but in the process of saving I don't know why the most part of byte array that contains the image simply disapear...
Can anyone tell me, please, how can we save an image in a SQL Server 2005?
Thank you!
P.S.: I'm using VB.NET 2005.
Miguel Castanheira
|
|
|
|
|
|
Thank you, but I already use that kind of sample with C#.
Unfortunately, I think that the problem is in VB.NET...
I'm need that code to work on VB.NET, because when I use C# it realy works good!
Can you explain me why?
Miguel
|
|
|
|
|
Here is a section of an object I use to solve the issue. _bm is a Bitmap and _ms is a MemoryStream. You should be able handle it from here.
public void Load(object dbField)
{
Clear();
if (dbField != DBNull.Value)
{
byte[] buf = (byte[])dbField;
_ms = new MemoryStream(buf);
_bm = (Bitmap) Image.FromStream(_ms);
}
}
public object Save()
{
if (_bm == null)
{
return DBNull.Value;
}
else
{
MemoryStream ms = new MemoryStream();
_bm.Save(ms,_bm.RawFormat);
byte[] buf = ms.GetBuffer();
ms.Close();
return buf;
}
}
|
|
|
|
|
Thank you, but I already use that kind of sample with C#.
Unfortunately, I think that the problem is in VB.NET...
I'm need that code to work on VB.NET, because when I use C# it realy works good!
Can you explain me why?
Miguel
|
|
|
|
|
|
can anyone correct for me this:
CString strText;
CString strSQL;
CDaoDatabase db;
db.Open("D:\\copyktt.mdb");
m_cedit.GetWindowText(strText);
strSQL.Format("INSERT INTO Table6 SELECT * FROM Table3 IN 'C:\\ktt.mdb' WHERE MyField = %s",strText);
db.Execute(strSQL);
|
|
|
|
|
Missing single quotes around %s...
Very bad practice here, vulnerable to sql injection attack. Just type x;delete * from Table6 into m_cedit and you're toast.
|
|
|
|
|
<br />
CREATE TABLE TestTable<br />
(Field1 INT)<br />
GO<br />
<br />
DECLARE @Err INT<br />
<br />
INSERT INTO TestTable (field1) VALUES (9999999999)<br />
SELECT @Err = @@Error<br />
IF @Err <> 0<br />
BEGIN<br />
PRINT 'Im In'<br />
INSERT INTO TestTable (field1) VALUES ('1235456')<br />
END<br />
<br />
SELECT * FROM TestTable WHERE field1 = 'ABC'<br />
SELECT @Err = @@Error<br />
IF @Err <> 0<br />
BEGIN<br />
PRINT 'Im In'<br />
INSERT INTO TestTable (field1) VALUES ('1235456')<br />
END<br />
When executing the above code, you will enter the first @Err condition but not the second. Both errors produce the same Severity level so I'm not sure why it resumes on one but not the other. Is there any way to force an SP to resume next?
-Kay
|
|
|
|
|
kayos592 wrote: When executing the above code, you will enter the first @Err condition but not the second.
I don't see where the second condition, a simple SELECT, could fail under normal conditions. It could return an empty result set, but that's about it.
What error are you expecting?
kayos592 wrote: Both errors produce the same Severity level so I'm not sure why it resumes on one but not the other.
I don't see what error the second condition is producing. And I don't know what you mean by "it resumes on one but not the other".
|
|
|
|
|
If you execute the attached code in SQL Query analyzer you will see what I'm talking about. Basically, if you try a simple select on an INT field where the where condition is looking for Alpha characters it will give you an error.
Simply put, the below code is a simple select which causes an error. Now I know I can check values prior to everything but I want it to continue onto the next record in the event that a simple select causes an error instead of just dying. Please let me know if I should elaborate...
<br />
CREATE TABLE TestTable<br />
(Field1 INT)<br />
GO<br />
<br />
DECLARE @Err INT<br />
<br />
SELECT * FROM TestTable WHERE field1 = 'ABC'<br />
SELECT @Err = @@Error<br />
IF @Err <> 0<br />
BEGIN<br />
PRINT 'Im In Error Handling number 2'<br />
END<br />
Now what I mean by "it resumes on one but not the other" is for the first error it will go into the error condition and even execute more of the script, however on the simple select error, it will stop right there and progress no further. Hope that clarifies...
-Kay
|
|
|
|
|
Hi all,
I need some help regarding SQL query.
I have the following requirement:
I have 3 tables(in bold) with columns as following:
Unit
UnitId
ListUnit
UnitId,ListId
List
ListId
And I have the records as following in the above mentioned tables:
Unit
1
2
3
ListUnit
1,1
1,3
2,1
2,2
3,2
3,1
List
1
2
3
Now I want to retrieve only top 1st (UnitId,ListId) from the group
I.e. 1,2 from (1,2
1,1
1,3) group.
Then
2,1 from (2,1
2,2) group.
And
3,2 from (3,2
3,1) group.
So how could I write SQL Query for this?
Thanks,
Rachit Damani.
|
|
|
|
|
You are saying groups, what exactly will be in a group?
When you say 1,1 from 1,1;1,2;1,3 what are these values?
are these a comination of unit and list tables or values from unitlist table?
Gautham
|
|
|
|
|
I needed to grant my windows login on SQL Server 2005 UNSAFE ASSEMBLY permission, which I was able to do with a simple grant statement, but under what authority am I granting that permission to myself? Is it the server owner or admin, being a member of administrators on the host, my machine?
|
|
|
|
|
My guess would be sysadmin on the grounds that the assembly could affect the entire server process, not just the database that uses it.
Checking the documentation it says for CREATE ASSEMBLY[^]: Only members of the sysadmin fixed server role can create and alter UNSAFE assemblies.
|
|
|
|
|
I'm starting to see the link to my machine login now. My Windows login on SQL is only a member of dbcreator, but the BUILTIN\Administrators group has the sysadmin role.
|
|
|
|
|
i started studying myself C++ and VC++ 4 months ago.i have done some simple applications.And my new task is show a table (in mdb)file in a list control in my application. And can copy selected row in the list control in another table in another location.Drafly like that.I have tried for 32or 3 weeks aready, but haven't finished yet and found a lot of problem.Am i too stupid?hehe
|
|
|
|
|
No! Keep trying, thats the way all learn!
Gautham
|
|
|
|