|
Anurag Gandhi wrote: Hi all,
Is there any way to retrieve the creation date of each row in a SQL table.
In my old table, I don't have [Creation Date] column. Table has already been created and data is also there. But i need to retrieve when each individual row of that table had been created. Do SQL maintain any log for each update of the table?
Please do suggest me what to do.
Without an explicit creation data, then no you can't. You can't rely on the rows timestamp because this isn't really a date/time - it just indicates when items were updated/inserted in the database.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Iam doing a project in ASp.net -Online exam
there are 25 questions and 4 options for each stored in SQL database .
I want one by one question to appear with 4 options.ie,
first page 1st question after NEXT Butoon clicked , 2nd , so on..
I also want each selected answer to check with actual correct answer stored in sql.
Please help.
thank u.
email to- e.suni@rediffmail.com
|
|
|
|
|
esuni wrote: Iam doing a project
Yes!! 'You have to do the project'
|
|
|
|
|
Your page will need to ask a question and display the possible answers, so you will need to display the question and put some radio buttons for the answers. When the user clicks Next, you will present the next question. What's your actual question? There's nothing in your post that indicates what you actually want. I sincerely hope that you aren't asking for somebody to actually write your code for you.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
If you need and idea then i can give you.
first create a database which has a table with columns holding
QuestionNumber,QuestionText,Option1,Option2,Option2,Option2,CorrectAnswer.
Then display each question either randomly or one by one using the question number.
Now display even the options with a radio button besides each option. now when a person check a radio button and submits an answer then check whether the option is same as the correctanswer column value of the respective question. Then u can go on doin this for the whole test.
Thnks
Kittu.
|
|
|
|
|
I would like some opinions on my database design. I'm running into some problems and I'm afraid I've made some bad choices regarding the table design.
In my database I have information on five different kind of users (among many other things). With the exception of two types of users, all of them are very different and have very different kind of information associated with them. Therefore I though it best to put each kind of user in a separate table.
So I have for instance a table called administrators, a table called translators, etc. etc. The problem is that sometimes I end up with a foreign key from some other table. I know the key is for a user but to get the actual user I need to either do some expensive JOINs, or use stored procedures where I can put some logic, etc. etc. Bottom line is that since a user are in one of five tables depending on which kind of user he/she is it's difficult retrieve the information.
I have thus started to wonder that maybe it would be best to keep all users in one big table although there would be many empty columns since many columns are only for one or two types of users.
Anyway, I would like some info and opinion on this - whadda you say?
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
Create a masetr table as for ur codes and for each typeof user make a row in that table and associate a code for that.
Take another table as access roles and define a role correcponding to a particular role.
ex there are three roles (table master role)
1) admin say code 1
2) superuser say code 2
3) Normaluser say code 3
table 2 access role
uniqueID code
1)gm0013 1
2)sr1235 2
3)us0001 3
3)us0002 3
3)us0003 3
3)us0004 3
now each time take a join with table 2 based on uniqueID(key for ur table)
u'll get code and as per this code u'll give access rights to that logon person.
each time when u want to check user access role scan the user
Regards,
Suyash
|
|
|
|
|
Make one table hold the common aspects of users; ID, name, address, etc.
Make seperate tables for the non-common aspects, linked by ID.
Create Views that mimic your current schema.
|
|
|
|
|
So clear - so succinct that I wonder why I didn't think of it myself.
Thanks...
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
RIGHT! Now give the guy a 5-vote. Voting helps identify the really valuable posters.
|
|
|
|
|
Hello
I have a problem with using ADO in Visual C++. I'm need to get tables names of database by using types from ADO type library. I found one method:
_RecordsetPtr rs_table_names = ado_conn->Execute(L"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES", NULL, -1L);
But there is a problem. This method allows me to get tables names only of SQL server, but with other database formats (MS Access, TXT files, Excel) it doesn’t work.
Thanks in advance.
|
|
|
|
|
It looks like that Jet provider doesn't provide access to INFORMATION_SCHEMA. I found discussion about such problems. May be it'll help you.
|
|
|
|
|
2Ilya: Thank you for link (Спасибо за ссылочку!).
I nave another question: how can I get field data format string.
When I used DAO, I got this string by DAOProperty::GetValue call.
For example, this string looks like "General Number","General Date","Long Date" or something like "#,##0.00."p.";=#,##0.00"p."".
|
|
|
|
|
Hi,
I have a long SQL querie and my TL has asked that I concatenate them so I am not repeating the same querie over and over again. The thing is, each querie is inside a new for loop so if I concatenate, it is not picking up the previous query. For example this is what I had before for each for loop except that the end where clause is different for each.
<br />
for bla bla<br />
{<br />
ring sql = "select e.Firstname,e.Lastname,r.Role,r.Description,d.DivisionName,a.Applications,m.ManagerFirstname,m.ManagerLastname,t.ProgLanguagesDatabase" +<br />
" from employees e,Division d,Manager m,TechnicalSkills t,Role r,Applications a where " +<br />
" e.ManagerID = m.ManagerID<br />
My TL wants me to write
for {
sql1 = blabla
}
for bla
{
sql2 = sql1 + (Sql query)
}
Obviously it is telling me that sql2 does not exist. At the moment I have something like this after the queries.
SqlDataAdapter myCommand = new SqlDataAdapter(sql, myConnection);
and obviously I can't overload this each time with sql2, sql3 etc)???
Sianny aka Sharny
|
|
|
|
|
Realistically, you should not be building SQL this way anyhow, you should be calling stored procs, from a data layer.
I'm not sure I follow, you will have multiple queries in one call ? then your string needs to be defined outside the first loop, so you can add to it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
if I declare them outside the loops
string sql1;
string sql2;
string sql3;
etc
then inside each for loop I have a sql query like
for ()
{
sql2 = sql1 + "where bla bla";
}
for()
{
sql3 = sql1 +"where bla bla";
}
Obviously sql1 and 2 and 3 etc are never assigned as they are defined outside the loops and it never picks up their value?
This is what the error is telling me anyway.
Thanks
|
|
|
|
|
ah...i think I worked it out now. I'm not sure if that is what you were trying to tell me anyway, but I have declared the common query outside all the loops like this
string sql = "Select e.Firstname,e.Lastname,r.Role,r.Description,d.DivisionName,a.Applications,m.ManagerFirstname,m.ManagerLastname,t.ProgLanguagesDatabase" +
" from employees e,Role r,Division d, Manager m, TechnicalSkills t,Applications";
then later i have used sql2 = sql + "where etc";
Is this the correct way?
thanks
Sharny
|
|
|
|
|
I expect each loop would end up adding a query to the main sql string, but, it's hard to say, I'm not entirely sure why you're putting strings in from more than one loop, or what the end product is to be. But yes, having one string to hold all the SQl was my suggestion.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thankyou. I need to have nested loops because I've got multiple user search options on a windows form. I have it working baced on what I said. I just had to do a bit more trial and error and I would've worked it out without asking.
Thank you
|
|
|
|
|
Hi.
How can I backup from DB (SQL Server) in code ?
Or using sql statements?
Best wishes
|
|
|
|
|
I think you can use stored procedures to create backups of the database. I don't remember what it is called.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Hi, all.
Is there any solution to intercept SQL statement on client workstation, stop it temporary, make some edit operations with WHERE clause, and send an upadated SQL to server?
Can i make it using C++? I've never met this task yet, so, could you tell me, where a have to dig (documentation, links, e.t.c). I'm interested in Oracle and SQL Server solutions. Maybe there is ready example?
Thanks a lot.
|
|
|
|
|
LinCorJDE wrote: Is there any solution to intercept SQL statement on client workstation, stop it temporary, make some edit operations with WHERE clause, and send an upadated SQL to server?
I think it would be better if you told us the bigger picture because I can't imagine this would be a very good solution to anything other than an attack on the database.
|
|
|
|
|
OK, try to do it.
So, we have ERP system "Oracle JDEdwards Enterprise One".(Who knows about this system - they understand me ) It generates SQL statement using visual tools:
link tables using "drag and drop", create WHERE statement using "mouse" method, not manual writing. I can add own WHERE's using only visual components. And there is no GROUP BY (!), i can not use any hints, and using SELECT in WHERE statement is impossible. All i need is to edit WHERE statement in system generated SQL.
|
|
|
|
|
|