|
Do complete DB backups or Tran Log backups are regular intervals. My general rule is to run a complete backup on Sunday at 3a and then run differential backups at 3a daily after that... each week overwriting the previous week (history is maintained through tapes).
-AC MCDBA
Andrew Connell
IM on MSN
andrew@aconnell.com
|
|
|
|
|
I want to install a SQL server 2000 desktop engine with mixed mode authentication on a Windows 2000 professional machine. By default the DB engine is installed in windows authentication mode. How do change that to mixed mode (windows autentication + sql server authentication). I have the SQL server 2000 developper edition CD.
Rustan
|
|
|
|
|
|
IT WORKED for me!
Don't worry, nobody lives forever.
|
|
|
|
|
I am using a database for storing a set of data, I want to do a query on this data, and select a random returned column. What is the best way to do this?
At present I am doing a query returning a single column 'count(*)' then repeating the same query this time returning the data I want, I then call SetAbsolutePosition() on a random row, to get the data I want.
This seems not to be too bad, but it is with quite a simple query at the moment, this will get a lot more complicated in the future.
I can't return the data I want and the count(*) column as this should only returns 1 row (and fails anyway).
One alternative would be to create a temporary table and then count the rows in this, but I don't know what the overhead of this would be.
Any other ideas? Is their a 'select a random row function' I am being blind to.
Kris
|
|
|
|
|
I think I understand.
Why can't you do your select count(*) to find the # of rows and then do a SELECT TOP [somerandomnumber] to get what you want. Then all you have to do is MoveLast.
|
|
|
|
|
Yes, but even so I still need to do two queries (one to get the count, the other to get my data).
I will try using SELECT TOP and see if it improves the speed.
Thanks
|
|
|
|
|
Hi,
I have a table consisting of an ID, a Date and a StatusCode. Basically it holds a log of when the status of things ('Defects') identified by the ID changed. (The ID is NOT unique in this table).
I am trying to develop an SQL statement that will return the ID and Date for records that have most recently been changed to a certain status. I am using MS Access.
The Query below will return the date that each Defect's status was last changed:
SELECT DefectNumber, Max(DateTime)
FROM MAIN_Status
GROUP BY DefectNumber
I want to be able to discard records from the results of this that are not currently "issued". NOTE: Using a WHERE StatusCode = "ISS" clause does not do what is required - it will give me the most recent date that each Defect has been issued. After a defect has been issued it can then be changed to completed and thus is no longer relevant.
I hope this makes sense...
Any suggestions at all would be great.
Thanks,
Alex
|
|
|
|
|
If I understand what you are asking, I think what you need to do is have a WHERE clause with an IN statement
SELECT DefectNumber, Max(DateTime)
FROM MAIN_Status
WHERE ID not IN (SELECT ID FROM MAIN_Status where sts = 'completed)
GROUP BY DefectNumber
|
|
|
|
|
Would this not just retrieve the Date for when each defect was last issued?
What I require is a list of defects for which the last action was to issue them, and i require the Date at which this took place.
I imagine this is hard to understand without a more verbose description of the problem. Perhaps explaining an analogous situation could help:
A table of employee details as follows:
DepartmentCode Name Salary
1 Alex 40000
1 Kevin 30000
1 Mark 20000
2 Bruce 50000
2 John 60000
3 Michael 70000
Say I want to find the employees in each Department with the highest salary.
I could do:
SELECT DepartmentCode, MAX(Salary)
FROM employees
GROUP BY DepartmentCode
to get a table with DepartmentCode and Salary, but how can i also get the Name of the highest paid person?
The Name is analogous to my StatusCode, if i can get the StatusCode in the results i can use perhaps a HAVING clause to eliminate the ones that are not "ISS".
I hope this makes things clearer
Thanks for your help
~Alex
|
|
|
|
|
Hello
I would like to be able to put files in my Database. But it appears to me( as a rookie) that the size of this files must be very limited. Is this true or am I only looking in the worong places. What type of data type should I use in SQL Server? Image? Binary? When I read the help on these types it seems to me that they only can be very small.
I would like to put files in there that can be up to 1-2 MB. Is this possible?
regards
Henrik
|
|
|
|
|
Typically, you would use binary column types. You can use TEXT type fields IF you encode your file (Base64 is common) before putting it in the DB.
I have put 10-20 meg files in a database, but it really wasn't a good design. I can't comment on your requirements, but for me it has always been better to have a predefined path on a server where files are placed and then just put the path to the file in the database.
|
|
|
|
|
Do you put the file name and file name in differnet columns like
FileName | FileExt | FileData |
1 Document1 xls .......
--------------------------------------
2 Document2 | doc | .......
--------------------------------------
3 Document3 | txt | .......
--------------------------------------
Or is there a better way??
regards
Henrik
|
|
|
|
|
Typically I just use on column and insert the file name like
\\NTSRVR01\DBData\SomeDir\SomeFile.someext
|
|
|
|
|
Thank you very much!!!
It's nice with friendly people when you feel stupid
|
|
|
|
|
I have to write a program based on an SQL Database. I'll write it in
VisualC++ with MFC and ATL... I have to use OLEDB... The program at
its root is composed of many dialogs (one for each table) and many
little search engines (one for each table).
Now the problem is: what model of data connection should I use? Should
I keep open a CSession for the entire time the corresponding dialog is
open? Or perhaps I should open the CSession, read the data, close the
CSession, let the user work on the data that I have loaded and then
reopen the CSession, write the modified row and close the CSession?
The COleDBRecordView class keeps the CSession open...
Another question: If I keep the CSession open, will the row a user is
working on be locked by the SQLServer? Does this depends on the
Isolation Level?
Bye
Max
|
|
|
|
|
Assuume I have the following query:
SELECT * FROM Table1
WHERE
field1 = 4 AND field2 IN (SELECT field FROM Table2)
I assume the SQL server begins a row scan. The question is: "Is the order of the fields in the where clause important?" meaning if current row has field1 != 4 will SQL skip it directly and will not scan the second table? And if I arrange the fields the other way will the second table always be scanned?
Best regards,
Alexandru Savescu
|
|
|
|
|
All depend of your indexs.
For example if you have a index in the table2 that starts with field and other index in the table1 that has field1 and field2 in this order, you will not have scans in your tables, but is very important how is the index, you need to do a good index.
Is not the same that the order in the index will be Field2, Field1 and use Where field2 = 1 and Field1 = 4 you need to evaluate if the index must be field1, field2 or field2, field1 and use that order in the query...
I hope to be clever...;)
Best Regards
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
Turn SHOWPLAN on and EXECUTE off and you can see what the optimizer does when you run the query both ways.
|
|
|
|
|
Hi,
I have been using ADO for a while now in my current project. Everything seemed to be working well (wishful thinking) until I noticed the following sequence of events:
1. use connection.Execute to run a UPDATE/DELETE etc query against the connected database
2. use connection.OpenSchema to get any schema information back
3. result is the '...the application is using argument that are of the wrong type...' error
Has anyone here experienced this bug, whereby using the Execute method, the connection object seems to get tainted against the OpenSchema method working properly.
I tried to disconnect, then reconnect before doing the OpenSchema call, but the same result.
Please help!
Simon
|
|
|
|
|
Hello,
I seem to have fixed this wierd error, though I don't know why it did!
When I do an action query, I use the connection.Execute method as mentioned. I passed it &vtMissing for the records affected parameter as I saw this in a MSDN example somewhere.
However, and this is the noodler, if I pass NULL for the records affected parameter, the problem goes away! No problem, but I don't see why this would fix it.
Simon
|
|
|
|
|
I'm working a database program using ado.In it ,i use Ado data control with DataGrid control.when i release the program,i have to change the a parameter in ado data control(connection string).for example,The path of old .mdb must to be changed to new path.However ,The ado data control has not change at all!After i used ado.setconnectstring().the program work well.But when the program is released to another pc,the error message appear"cannot initialize data bindings". as if It's from DataGrid. but i don't know how to reset Datagrid or ado parameter.who can help me,please?
|
|
|
|
|
With arrival of yet another Jet 4.0 Service pack (SP6), In 4!!! different exes depending on OS version, is it possible to have installshield to install the latest Jet version along with MDAC in my applications MSI file?
(Solutions using Visual Studio Installer would also be helpful... I don't like Installshield much)
Thanks...
Blade[DMS]
|
|
|
|
|
check in the site of the product...
May be Install Shield, developed a new object for that.....
regards
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
Yes I've found that...
Thanks...
Blade[DMS]
|
|
|
|