I have 2 installations:
1. W2k with MS SQL 2000 sp2.
2. W2003 with MS SQL sp3.
There are two databases in all instalations: "maindb" and "userdb". The
table with data is in maindb.
In the 1'st installation I restict user access to all data in table in this
way:
- create user's login and user in databases maindb and userdb.
- create view in userdb with "where" clause as dbo (dbo is owner of this
view). This clause restict access to data. (create view userdb.dbo.table as
select * from maindb.dbo.table where ...)
- add user to group "Public" in maindb.
- add role "data reader" to user in userdb.
- effect: user can access data only by view, can not access any data in
maindb.
I do the same in secound installation:
- effect: user can not access data by view - message like this: "user
have not permission to select on maindb.dbo.table"
Is this bug in sp3 or in sp2 ?
Is there another way to horizontal restrict access data in tables?
In Sybase ASE this method (restict by view) works ok. And there is new
property of ASE 12.5.1 - administrator can define context of login - the
"where" clause will be added automatically to any select.
About a month ago I restored a data base that had been originally created in MSDE into a full version of SQL Server 2000. I thought that the size restriction would automatically be removed by putting it into the full version of SQL. I was wrong and about a week or so later the data base reached the 2GB size and needed attention. I received some assistance through Microsoft and they walked my client through the process of removing the size restriction. Since then everything has been OK.
Now I am doing something similar. My client has a data base that was originally created in MSDE. We upgraded them to SQL Express and the data base has now grown to 4GB which is the max that SQL Express allows.
We will be installing SQL for Workgroups this week.
My question is this. Is there a setting I must change inside the data base or in SQL for Workgroups that will allow the data base to grow beyond 4GB? We need to let it expand to whatever they need and I cant seem to find any documentation on whether or not I have to change a setting for this data base.
Could anybody tell me how to convert vertical data into horizontal data?I have a one-to-many relationship in sql server 2KProduct, ProductAccessory, one Product has many ProductAccessories.My Table design is like this:Table Product{ ProdId int, ProdNameId int, ....}Table ProductAccessory{ ProdId int, AccNameId int, AccUnitId int, ....}Because one Production has at most 4 ProductAccessoryI want to use a SELECT statement OR function to return ProdId, ProdNameId, AccNameId1, AccUnitId1, AccNameId2, AccUnitId2, AccNameId3, AccUnitId3, ....Any help will be appreciated! Thanks a lotJoseph
I have a table as follows opendate (datetime) callnumber (int) closed (bit)
I want to find how many calls were opened today and of those how many are closed
I have come up with the code below but again am looking for 1. a more elegant solution 2. a way to generalise this to show the same information for x number of days
create table #holdit1 (opencount int)
create table #holdit2 (closedcount int)
insert into #holdit1 SELECT count(*) as opencount FROM [dbo].[problog] WHERE datediff(dd, opendate, getdate()) = 0 AND closed = 0 group by closed
insert into #holdit2 SELECT count(*) as closedcount FROM [dbo].[problog] WHERE datediff(dd, opendate, getdate()) = 0 AND closed = 1 group by closed
select #holdit1.opencount AS CallsOpen, #holdit2.closedcount AS CallsClosed, #holdit1.opencount + #holdit2.closedcount AS AllCalls from #holdit1 cross join #holdit2 #holdit2
DROP TABLE #holdit1 DROP TABLE #holdit2
this gives me CallsOpen CallsClosed AllCalls ----------- ----------- ----------- 1 3 4
I am working with a dynamically populated multi value parameter drop down list. In the case where there is only one value in the list, the horizontal scroll bar (due to the length of the value) covers up the first, and in this case only choice. The users cannot see it. This problem is only when running in report manager. It works ok in Visual Studio.
As a work around, I can add a dummy row, which then at least the users can see one row of data and then scroll down but, I would rather not do that, if there is another solution. Another option would be to set the default on the parameter so it is automatically selected but, in the case where there are many values, I do not want a default set.
I want to access mssql2000 server only by 'sa' & database login ids. I want to restrict windows administrator account to access the database. Please help !!!
Our enviorment :- SQL2000 with SP3 on Windows2000 advanced server with latest service pack..
Hi everyone, My first table has a column named "customer" that is directed to "customers" table "id" column as foreign key. I wanted to change "id" name so i wanted to delete it and create another column of another name but i cannot delete that column because it is attached as fk to another table. How can i remove th fk constraint ? Thanks.
I'm inserting rows from one table to another and trying to figure out how to not allow nulls from one field. ie - the feeder table can have nulls, but when I insert into the other table, I don't want the records that have NULLS in one field to insert. I hope that's clear.
First of all I would like to show my satisfaction at this great forum.
I'm quite a beginner at SQL and would like to ask a question.
Let's say I have a table of Students and a table of Subjects with their respective details. Now I want to create another table that references both the previous tables so that I would know what subjects the Student is attending. My problem is how to put a restriction in the new table on the number of subjects that each student can have (e.g. each student can only apply for 8 subjects, not more).
I've heard about triggers and other possible solutions, but it's too advanced for me at the moment, so I'd like to possible find a solution through the new table.
Roughly, I guess the new table (let's call it StudentAttends) will have the student id from the Students table and the subject id from the Subjects table. Now how should I add the above restriction?
Hi, Ive been told this, but I hope it is NOT true. I have an sqlserver2000 installation running on a server that has four processors.It is on a active network but is not the domain controller soessentially it is fully dedicated to servicing the needs of sqlserver, (a bit of browsing, a bit of ms Office, but almost whollydedicated to sqlserver. Now, the big question, why, when the serverproperties have been set to utilize all four processors, can any onejob never get more than 25% of cpu time? I can launch multipleinstance of QA and run the same job on each one and that will utilisemore and more cpu time, but if you launch multile QA windows fromwithin one insance of QA, you can NEVER get more than 25% CPUutilisation. Now i have to run a job (FTS is a good example,re-indexing lots of db's another, or even a huge query with multipleufd's on computed cols which I hoped would grab lots of CPU time thatthey need, but no. So do I have to live with this or can I tell eitherwindows or sql server to grab more cpu when it want to ie use my spareCPU capacity more efficiently or am i working on a misguided premiseand 25% per job is your lot?DMAC
Well, so .. If I don€™t want bad Dates-Strings stored in this table, for the ValueType = 2, .. What kind of constraint-restriction or maybe a trigger, I need to use and please tell me how to aplly using management studio ?
I have two employee tables called EmpA and EmpB.Each table has the same attributes of Employee ID and Email address.I do an inner join on email address like this:
select * from EmpA inner join EmpB on EmpA.email = EmpB.email where EmpB like '%@mydomain.com'
I now want to modify the above where I want to output rows such that
I need to ensure some naming standards to users while creating tables.
All table name should be in same pattern
(ie., ) TeamName_EmpId_tablename
I need a way to restrict user to follow the naming standard. If any user tries to create table without the above naming standard system should not allow.
I would like to know if there is any option to Restrict DML statements in SSMS for a user where the same user should be able to perform these actions through application on particular database.
If I have the raw data dumped into a big table as following:
Date P R M E Date P R M E Date P R M E Date P R M E 1/1/90 1 2 3 4 1/1/90 2 3 4 5 1/1/90 3 4 5 6 1/1/90 4 5 6 7 ... 1/1/05 1 2 3 4 1/1/05 2 3 4 5 1/1/05 3 4 5 6 1/1/05 4 5 6 7
And this table has a repeating block [D, P, R, M,E] 300 times. Is it possible to write a loop query/stored procedures/triggers (or whatever it is) to read each repeating block and stack them on top of each other to insert into another table which has the same structure as following?
Look like this? Date P R M E 1/1/90 1 2 3 4 ... 1/1/05 1 2 3 4 1/1/90 2 3 4 5 ... 1/1/05 2 3 4 5 1/1/90 3 4 5 6 ... 1/1/05 3 4 5 6
If there is a solution would you please elaborate, example? Thank you for the help. shiparsons
Hello all,Thinking about building a new database in the enterprise addition ofsql server and using some horizontal parititioning techniques in orderto accomaodat what will eventually be a monster huge database.Can you share some hard earned experience, gotchas, etc...with me? Wewill be setting up this server on a SAN array that will be made up ofjust one or two huge virtual RAID10 volumes and I am also wonderingabout the wisdom of this? Its simple and should work, but is thatconfig relevant in any way specifically to our plan to partition?
I am testing horizontal partitions to see whether it is a feasible option for a project. IF I have a composite Primary Key and the constraint column (a part of the Primary Key) that helps the partitioned view is defined with DateTime Data Type, select on a restricted set of data through a partitioned view still tries to access all the tables instead of just one table that contains the data. Is this the case or am I missing something ?
CREATE TABLE [dbo].[tst01] ( [Dt] datetime NOT NULL , [TID] int NOT NULL , [Nm] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ) ON [PRIMARY] GO
CREATE TABLE [dbo].[tst02] ( [Dt] datetime NOT NULL , [TID] int NOT NULL, [Nm] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ) ON [PRIMARY] GO
ALTER TABLE [dbo].[tst01] ADD CONSTRAINT [PK_tst01] PRIMARY KEY CLUSTERED ( [Dt], [TID] ) ON [PRIMARY] GO
ALTER TABLE [dbo].[tst02] ADD CONSTRAINT [PK_tst02] PRIMARY KEY CLUSTERED ( [Dt], [TID] ) ON [PRIMARY] GO
ALTER TABLE [dbo].[tst01] ADD CONSTRAINT [CK_tst01] CHECK (Dt between '11/1/2002' and '11/30/2002') GO
ALTER TABLE [dbo].[tst02] ADD CONSTRAINT [CK_tst02] CHECK (Dt between '12/1/2002' and '12/31/2002') GO
insert into tst01 values('11/1/2002', 1, 'SS') insert into tst01 values('11/2/2002', 2, 'KK') insert into tst01 values('11/3/2002', 3, 'DD') Go
insert into tst02 values('12/1/2002', 1, 'LL') insert into tst02 values('12/2/2002', 2, 'MM') insert into tst02 values('12/3/2002', 3, 'GG') Go
CREATE VIEW vtst AS SELECT * FROM tst01 UNION ALL SELECT * FROM tst02 Go
I'm running SQL Server 2008 Standard.I need to create a query that has data from multiple columns (Columns 1-6 with coresponding Date started and Date Completed data) displayed vertically, but also has the column name the preeceeding column to identify it...along with other data (Record number, status).
I'm considering using horizontal partitions to separate my data by year. For example, SomeTable_2004, SomeTable_2003, etc. This works well for backups, maintenance, etc. because I'm working with 150+ GB of data. I'll be a partitioned view for queries.
However, I'm new at this and have a few questions. I would also like to do partitioned updates or inserts. But I need to make sure that the tables don't use similar primary keys. Does that make sense? I need to make sure that the primary keys from the first table are not used again in the second table.
SomeTable_2003 primary keys: 1,5,8,9,15
SomeTable_2004 primary keys: 2,3,4,10
I don't really care what keys are used on what table, as long as they are different. I have apps that already use this data, and I don't want to change the application logic.
factory2 goods 1kg 5.50 factory2 goods 2kg 6.20 and so on for all factories.
I tried with UNPIVOT but it does not allow it (I'm using Navicat 8), saying "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near UNPIVOT...".
I recently came across a database where the data are horizonally partitionedinto 4 tables. I'm not sure if this was a poor design choice, or if it wasdone for valid performance reasons. The schema of the tables are essentiallythe same, it's just that they are named differenly and the columns are nameddifferenlty to differentiate the data from a business usage perspective. Thetables could easily be combined inot one by adding a new colum to theclustered index that would be used to differentiate the business usage. I amtrying to evaluate whether combining the tables would improve performance orif it would be better to leave them the way they are. Many queries that runagainst these tables do not request records from more than one of thetables, which is good. However, there are a number of processes that queryagainst all of the tables on the identical clustered index range. I am notsure exactly how many rows are in the tables but I'm fairly certain theentire database is < 50 GB.
Anyone know why the horizontal scroll bar doesnt show up when the data is too large to fit into the given window? The vertical scroll bar will show up but never the horizontal.
HI, I'm testing out partitioning for an upcoming project and I'm a little confused over the query plan im generating.
I have a 13 million row table I want to break in to date ranges: tables are calljrnl,calljrnl_1999 and calljrnl_2000. The calljrnl table contains data for the last six months. one view, calljrnl_view is a union all of these three tables.
alter table calljrnl_1999 add constraint dt_constraint_1999 check (cj_created_dt <='1999-12-31 23:59:59')
alter table calljrnl_2000 add constraint dt_constraint_2000 check (cj_created_dt >='2000-01-01 00:00:000')
alter table calljrnl_2000 add constraint dt_constraint_2000_2 check (cj_created_dt <='2000-09-30 23:59:59')
The problem I'm having is that when I query on any date range outside the constraints set on the calljrnl_2000 table, It still wants to scan the calljrnl_2000 table. I'm assuming this has something to do with how the constraints are structured, but I am not able to find the right combination.
I have a table with 52 million rows which resides on Primary file group in my database. Because of huge number of rows the performance has gone very down and I would like to break the table into parts.
Can anyone suggest me the steps for doing the same and the number of parts that should be made. It is named as Account_Transactions and contains information of Policies in an insurance database.