I have a table (MainTable), each row contains data for a civil engineering project and the county where the project is located. The DB users, engineers, have been assigned a set of counties in New York State (NYS), this relationship is established by another table (EngineerCountyTable). When MainTable must be updated these are the rules:
I do not want an engineer to be updating data for a project located
in a county, which has not been assigned to him. I want all
the engineers.
Engineers can see all projects regardless of the county where the
project is located.
Is there any way to assign permissions in SQL Server based upon the content a row (County in this case)? Thanks
Related
I have a mini account software. In this software I can store multiple company data. The data is stored in SQL Server 2008 R2 database.
In current database I have a User table which stores all user names, a Company Master table which stores company details like name,address, session etc. and user ID as FK with user table. Next is tran table which link with company Master and stores vouchers details and others table link to tran tabel like bill, payment etc.
The app is build for small companies and professionals who keep & maintain there their client data. In that scenario all data is separate and mutually independedent. In case of the small company they maintain all subsidiary company's account related data in a single app. Some time they receipt or send any one subsidiary company data to that company or any government body or Audit firms. like mobile phone contacts, I can send all contacts or any selected contact.
Users used to select his/her company first form company Master and then add/edit reference data or view report on the basis of selected company ID.
Now my problem is the data volume is become very high on some client places because of 50 to 60 companies data are stored in a single database and how I get company ID wise backup or restore the data. Is filegroup of sql server can help on this matter? I have no knowledge of filegroup.
Please help me.
Do not split your SQL database into multiple SQL databases (either do not create more filegroups etc.) just because you need to get data filtered by the CompanyId. Everytime when your Client would need to create a new Company, your application would have to create a new database for it. This would also quite complicate things like app updates.
If you do not face any grave performance problems - like when using SQL Express and your client database is 9 GB (max. database size for Express is 10 GB) - leave 1 database for 1 client.
Be sure all your related tables are well indexed by the CompanyID column. Then you can provide means to export data by CompanyID from your application - custom reports, exports to csv files, Excel etc.
Database backup file is usually not used for passing data to other applications. Its goal is to assure disaster recovery - when the disk fails etc. then your client will be able to recover easily. On contrary when he would have 50 database files in place of just 1 he would have hard time restoring all those databases properly.
Very new to the world of advanced access and SQL Server 2005. I have now developed all my tables in SQL Server and added them to my blank database now in access using a ODBC connection. This topic is just for advice really, what would be the best way for me to create a form so that users within the company can input customer data without having to go onto SQL?
I have three tables 'Customer Table' 'Enquiry Source' & 'Admin Staff' - the 'Enquiry Source' & 'Admin Staff' consist of Enquiry Source ID, Enquiry Source Name, Admin Staff ID & Admin Staff Name which than have a link to the Customer Table.
When updating the tables myself in the SQL Side I use the ID's as integers but now I am in access I would like my users to be able to update these using the appropriate names on a list box. I have created a View in SQL and exported it to access but when I complete all the information and try and save the record it won't allow me to update multiple tables - which I understand is due to it being a View.
Is there an easier way of doing this so my teams can add new customers on the MS access front end system?
The Enquiry Sources are names of methods of referal: Newspaper, Recommendation, Google etc
The Admin Staff are names of employees creating the Customer.
Thanks Guys!
Callum
Link the three tables or three simple views on the tables. Use the form wizard to create a form based on the customer table. Use the list box or combo box wizard to create a control based on each of the two look-up tables. See create form to add records in multiple tables for some notes on how to use the wizards.
I am creating an application in Microsoft Access. This is for a small database that the customer will run on a desktop. No network of any kind will be involved. All the necessary files to use the database must be on a single desktop computer.
I want to deliver the app to my customer in stages. Most likely I will email the .accdb file to the customer. How do I deliver an update and maintain any data already entered by the customer? Updates may include changes to the table structure as well as to forms.
The answers given to my original question address the issue of changing forms and other UI elements. However, what if I want to add a table or add column to an existing one? How do I seamlessly deliver such changes while preserving as much data as possible on the user's end?
Split the database and the interface into separate files. Google should have plenty of information as this is typical for MS Access apps.
Here are a few resources to get you started:
How to manually split a Access database in Microsoft Access
Splitting an Access Database, Step by Step
You absolutely MUST (!) split your database into two parts. A backend part storing the tables ("the database") and a frontend containing the forms, reports, queries and application logic ("the application"). Link the tables from the backend to the fontend.
The frontend might also contain tables with control paramameters, report dictionaries etc., but no data that your customer enters!
Newer versions of Access have a database splitting wizard.
You might need a code that automatically links the backend to the fontend on the customers site.
UPDATE
You have two possibilities to alter the schema of your database on the customers PC.
1) Do the Updates through the DAO (or ADOX) object models. e.g.
Set tdf = db.CreateTableDef("tblNew")
tdf.Fields.Append tdf.CreateField("fieldname", dbText)
...
db.TableDefs.Append tdf
2) Use DDL queries
CREATE TABLE MyNewTable (
ID AUTOINCREMENT,
Textfield TEXT(50),
LongField LONG,
...,
CONSTRAINT PK_MyNewTable PRIMARY KEY (ID)
)
Or
ALTER TABLE SomeExistingTable ADD COLUMN Newcolumn Text(50)
I coded an application using C++/CLI and SQLite3, I would ask about how can I do the following:
Suppose that I uploaded SQLite database to a LAN, where any end user (uses my application) can check his database whether it was updated or not. If not, I want to add ability of adding the new records to the user database. What I want is some thing similar to AntiVirus software, the user can check the database online every day. I want the key points.
Or use a versionNumber field to check against
You should add a TimeStamp field to all tables, which is filled with the actual creation time of the record (via your programm or an autovalue).
You customer program can then select the newest entry in his database, gets the TimeStamp and selects all entrys that are newer in the online database and add all newer ones to his database.
Actually I want to migrate a large dataset to another database which already has some data. Data Schema is same in Both DB. Scenario is that my client has application that already running in production and he had given me some new requirements to implement that. after implementation he want to test new requirements on temporary production server for acceptant testing on 2 Locations. So that I have attached existing database to new production server. Now I want to write a DB script that migrate data of location between before and after acceptance testing. My problem is that Ticket ID of my table has identity and running application on both data servers will insert same TicketIDs. Now when I migrate the data, there is a conflict of Primary Key. My schema of parent table is as follow.
TicketID, Identity(1,1) int
LocationID int
Problem varchar(500)
IssueDate DateTime
Another issue is that Ticket ID is print on Customer Receipt and client don't want to change Ticket No.
Please suggest me solutions of this problem.
One Solution is that to add a column OldTicketID but for that I need to change my application code and I don't want to change that there are many child table of that.
You can change the identity column to only generate odd numbers on the old dataset (identity(1,2)) and only even numbers on the new dataset (identity(seed,2)).
Seed should be set to the highest ticketid that's currently in the production system, so there wouldn't be any conflicts with the ids.