Tag Info

New answers tagged

0

I would suggest to use transaction table as warehouse table.because sometime two many references also cause low performance in getting data. but if you are not in a production db situation which populate db with bulk data in seconds you can use those references and customers pk is important in transaction table. your second part of question is look up from ...


0

You cannot drop a database if someone is connected to it. You would need to force everyone off the database first (and to do that you need SYSCTRL authority for the instance, and I'm gonna guess DBADM at the database level if you don't have instance level authority). db2 connect to xydb --the next command forces off the users asynchronously db2 quiesce ...


2

This can be done. The column default for your serial primary key is typically defined as: ALTER TABLE schema_a.tbl ALTER COLUMN tbl_id SET DEFAULT nextval('schema_a.tbl_tbl_id_seq'::regclass); Two options: 1. Move sequence (my preference) to the public schema - or any schema with sufficient privileges: GRANT USAGE ON SCHEMA public TO public; -- or: ...


0

Your options are: Use roles, and SET search_path on each role so it looks in the appropriate organization's schema. While in many ways the cleanest approach from a database perspective, this is a pain when giving orgs the right to manage their own users. Require users to specify their organisation at login time, probably with user@domain style logins, or ...


1

TWO TABLES IN THE CURRENT DATABASE If you want to know if two tables are different, run this SELECT IF(COUNT(1)>0,'Differences','No Differences') Comparison FROM ( SELECT column_name,ordinal_position, data_type,column_type,COUNT(1) rowcount FROM information_schema.columns WHERE table_schema=DATABASE() AND table_name IN ...


2

You can compare checksum of output of SHOW CREATE TABLE product_today # mysql -NBe "SHOW CREATE TABLE sakila.actor"| sed -r 's/AUTO_INCREMENT=[0-9]+/AUTO_INCREMENT=XXX/g' | md5sum # 1bc0d72b294d1a93ce01b9a2331111cc -


0

Take a look at the columns table in the information_schema - the column_type field. That will allow you to compare table structures.


4

It looks like you'll need to change the user's default database, as it appears this is currently set to DB1, which no longer exists. exec sp_defaultdb @loginame='user1', @defdb='DB2' OR ALTER LOGIN <login_name> WITH DEFAULT_DATABASE = <default_database>


1

No. You should combine receipts and purchases, because they are 1 to 1 correlated - there cant be more than one receipt for one paypal purchase, and vice versa. Same goes for Bank Purchases. Therefore ALL of these basically constitute "Purchases". What you call 'receipt' just seems to be the act of CONFIRMING the purchase, and nothing else. Withdrawals ...


0

Yes, this can be done. In the open source community, it has been done for years. In most situations, they just prefixed the tables. I am not aware of a tool to simplify the process. You are aware that you introduce new challenges. Permissions. Queries are more complicated and may lose some performance. An alternative approach is to move to ...


0

I would commend alternative 1 to you. Just as having cells as columns a01, a02 etc. is poor normalisation so, too, is having measurements as m01, m02 and so on. In your example you have disguised this by calling them foo, bar and baz, but that is what they are. To address this what you call measurement whould more usefully be called Well: CREATE TABLE ...


0

Shouldn't be too difficult, the below assumes you are using SQL Server. My design would be to have a table called "CurrentLogOn", which would look like: LogOnID (PK - AutoIncrementKey) UserName IPAddress LogOnTime (DateTime, default to GETDATE()) LogOffTime (DateTime, no default) You would then want a second table called "HistoricalLogOn", which would ...


0

Looking at the data you posted, what would be the expected result from your point of view? The fact that users share the same desk/IP shouldn't be a problem as long as both users are reported while they're logged in. You could either use your current table design (a single table with Row_Id, update_time, IP and User) or an aggregated table with Row_Id, IP, ...



Top 50 recent answers are included