I want to remove some columns from table "User_" of Liferay Database (Lportal) as I don't want to store user's last login IP address. I know about Monitoring in Liferay but that can be turned off.
How can I stop Liferay from storing unnecessary details of user?
Oh, this is a different level than usual. First of all: You don't write directly to the database.
Now for the next level: You don't change the structure of the database. While there might be less of an argument not to add columns, you definitely never ever ever ever remove columns.
That out of the way: If it's just the last login that you want to get rid of, you edit your portal-ext.properties file and configure it. Liferay's default is
# Set this to true to record last login information for a user.
#
users.update.last.login=true
naturally, you'll set it to false. However, beware of LPS-51051, you might need to patch for this issue if you run into the described behavior.
I have a db containing info for a party.
I have a look-up field for who invited them, this is just a list of 4 names.
When I change this it changes characters in the last name column of the same row to ones that weren't even in the normal Latin alphabet.
The reverse happened as when I went to change it back it then changed the invited by column into some Chinese (looking) characters, breaking it's own validation as I said only items in the list were allowed, but it was fine with that for some reason.
Any idea what could be going on in this situation?
Also when I create a new table it doesn't appear in the Access Objects list until I reopen the database
The issue seems to have been caused by some corruption in the Access database file. Performing a "Compact and Repair Database" operation in Access appears to have resolved it.
I am working on an SQL project and I am fairly new to SQL.
In the problem, there are accounts that are registered and accounts that aren't. What is the correct syntax to filter all of the registered ones onto one side and the non-registered one on the other side.
I am trying to make it look like two different columns.
Based on your edit, you're well on your way already. The missing part seems to be catching the banks that are registered in the first query, and the non-registered ones for the second query.
To do so, you can use a WHERE clause on the registered column to only grab those you want, like so (assuming registered will contain 1 for registered and 0 for unregistered:
...
WHERE
name LIKE '%bank1_201001%'
AND registered = 1
...
UNION ALL
...
WHERE
name LIKE '%bank2_201001%'
AND registered = 0
...
That would probably also remove the requirement for having to put in the actual bank name (I'm guessing you're doing that because you know the first one is registered and the second one is not?).
I'm not entirely certain if this is what you need. Particularly the "I'm trying to make a registered column with the banks that are registered underneath it" is kind of confusing. You initially select the name, which would be the bank name. The Registered column would then be a boolean column indicating Yes or No (or 1" and 0).
Let me know if this helps?
i have a front end in access and back end is sql server 2008
one of the fields is the account number and here are the rules
it is a zipcode like 92111 plus a dash plus a number.
so the first one would be 92111-1, the second 92111-2
this has to do with how many clients we have in the zip code
i would like this zip code to be automatically generated. here is what i need:
the user enters the zip code
i have a stored procedure that checks if this zip code exists already, to increment it: if 92111-4 exists already, then make it 92111-5.
what is the proper way of doing this?
If you're storing both the zip and the client sequence number in a single account number field, you would have to split them apart to figure out the next sequence number in a given zip code.
It should be simpler to store them in 2 fields:
zipcode sequence_num
92111 4
92111 5
Then derive your account number field with a query whenever you need it.
SELECT zipcode & "-" & sequence_num AS acct_num
FROM YourTable;
Then when you need to determine the next sequence_num, lngNextSequenceNum, within a given zipcode, pZip:
lngNextSequenceNum = DMax("sequence_num", "YourTable", "zipcode = " & pZip) +1
That approach can work fine for a single user application. If your application is multi-user, you need something more refined. However, that requirement exists whether you store "account number" as a single field or split it between two fields.
See Create and Use Flexible AutoNumber Fields for a multi-user approach.
I agree with HansUp that you should keep the ZIP and sequence separated. You can create an indexed computed field called AccountNumber which joins the zip and sequence.
The only way I know of doing this is locking the table, selecting max(sequence) ... where ZIP = 12345, inserting the new record, then unlocking the table. However, locking the table means everyone else has to wait, greatly affecting scalability. I can't recommend this, but I don't have another solution.
I have a huge database (800MB) which consists of a field called 'Date Last Modified' at the moment this field is entered as a text data type but need to change it to a Date/Time field to carry out some queries.
I have another exact same database but with only 35MB of data inside it and when I change the data type it works fine, but when I try to change data type on big database it gives me an error:
Micorosoft Office Access can't change the data type.
There isn't enough disk space or memory
After doing some research some sites mentioned of changing the registry file (MaxLocksPerFile) tried that as well, but no luck :-(
Can anyone help please?
As John W. Vinson says here, the problem you're running into is that Access wants to hold a copy of the table while it makes the changes, and that causes it to exceed the maximum allowable size of an Access file. Compacting and repairing might help get the file under the size limit, but it didn't work for me.
If, like me, you have a lot of complex relationships and reports on the old table that you don't want to have to redo, try this variation on #user292452's solution instead:
Copy the table (i.e. 'YourTable') then paste Structure Only back
into your database with a different name (i.e. 'YourTable_new').
Copy YourTable again, and paste-append the data to YourTable_new.
(To paste-append, first paste, and select Append Data to Existing
Table.)
You may want to make a copy of your Access database at this point,
just in case something goes wrong with the next part.
Delete all data in YourTable using a delete query---select all
fields, using the asterisk, and then run with default settings.
Now you can change the fields in YourTable as needed and save
again.
Paste-append the data from YourTable_new to YourTable, and check
that there were no errors from type conversion, length, etc.
Delete YourTable_new.
One relatively tedious (but straightforward) solution would be to break the big database up into smaller databases, do the conversion on the smaller databases, and then recombine them.
This has an added benefit that if, by some chance, the text is an invalid date in one chunk, it will be easier to find (because of the smaller chunk sizes).
Assuming you have some kind of integer key on the table that ranges from 1 to (say) 10000000, you can just do queries like
SELECT *
INTO newTable1
FROM yourtable
WHERE yourkey >= 0 AND yourkey < 1000000
SELECT *
INTO newTable2
FROM yourtable
WHERE yourkey >= 1000000 AND yourkey < 2000000
etc.
Make sure to enter and run these queries seperately, since it seems that Access will give you a syntax error if you try to run more than one at a time.
If your keys are something else, you can do the same kind of thing, but you'll have to be a bit more tricky about your WHERE clauses.
Of course, a final thing to consider, if you can swing it, is to migrate to a different database that has a little more power. I'm guessing you have reasons that this isn't easy, but with the amount of data you're talking about, you'll probably be running into other problems as well as you continue to use Access.
EDIT
Since you are still having some troubles, here is some more detail in the hopes that you'll see something that I didn't describe well enough before:
Here, you can see that I've created a table "OutputIDrive" similar to what you're describing. I have an ID tag, though I only have three entries.
Here, I've created a query, gone into SQL mode, and entered the appropriate SQL statement. In my case, because my query only grabs value >= 0 and < 2, we'll just get one row...the one with ID = 1.
When I click the run button, I get a popup that tells/warns me what's going to happen...it's going to put a row into a new table. That's good...that's what we're looking for. I click "OK".
Now our new table has been created, and when I click on it, we can see that our one line of data with ID = 1 has been copied over to this new table.
Now you should be able to just modify the table name and the number values in your SQL query, and run it again.
Hopefully this will help you with whatever tripped you up.
EDIT 2:
Aha! This is the trick. You have to enter and run the SQL statements one at a time in Access. If you try to put multiple statements in and run them, you'll get that error. So run the first one, then erase it and run the second one, etc. and you should be fine. I think that will do it! I've edited the above to make it clearer.
Adapted from Karl Donaubauer's answer on an MSDN post:
Switch to immediate window (Ctl + G)
Execute the following statement:
DBEngine.SetOption dbMaxLocksPerFile, 200000
Microsoft has a KnowledgeBase article that addresses this problem directly and describes the cause:
The page locks required for the transaction exceed the MaxLocksPerFile value, which defaults to 9500 locks. The MaxLocksPerFile setting is stored in the Windows registry.
The KnowledgeBase article says it applies to Access 2002 and 2003, but it worked for me when changing a field in an .mdb from Access 2013.
It's entirely possible that in a database of that size, you've got text data that won't convert to a valid Date/Time.
I would suggest (and you may hate me for this) that you export all those prospective date values from "Big" and go through them (perhaps in Excel) to see which ones are not formatted the way you'd expect.
Assuming that the error message is accurate, you're running up against a disk or memory limitation. Assuming that you have more than a couple of gigabytes free on your disk drive, my best guess is that rebuilding the table would put the database (including work space) over the 2 gigabyte per file limit in Access.
If that's the case you'll need to:
Unload the data into some convenient format and load it back in to an empty database with an already existing table definition.
Move a subset of the data into a smaller table, change the data type in the smaller table, compact and repair the database, and repeat until all the data is converted.
If the error message is NOT correct (which is possible), the most likely cause is a bad or out-of-range date in your text-date column.
Copy the table (i.e. 'YourTable') then paste just its structure back into your database with a different name (i.e. 'YourTable_new').
Change the fields in the new table to what you want and save it.
Create an append query and copy all the data from your old table into the new one.
Hopefully Access will automatically convert the old text field directly to the correct value for the new Date/Time field. If not, you might have to clear out the old table and re-append all the data and use a string to date function to convert that one field when you do the append.
Also, if there is an autonumber field in the old table this might not work because there is no way to ensure that the old autonumber values will line up with the new autonumber values that get assigned.
You've been offered a bunch of different ways to get around the disk space error message.
Have you tried adding a new field to your existing table using Date data type and then updating the field with the value the existing string date field? If that works, you can then delete the old field and rename the new one to the old name. That would probably take up less temp space than doing a direct conversion from string to date on a single field.
If it still doesn't work, you may be able to do it with a sceond table with two columns, the first long integer (make it the primary key), the second, date. Then append the PK and string date field to this empty table. Then add a new date field to the existing table, and using a join, update the new field with the values from the two-column table.
This may run into the same problem. It depends on number of things internal to the Jet/ACE database engine over which we have no real control.