I have created a program that allow the user to register account as new user to sql. I do not want everyone use the same account (default sa).Now i want to group those users into one group which easy for management.But I cant find way to create new login group.I search over net, they said need to done under computer management--local user and group, but my computer do not have local user and group..
My issue is that I have 10 accounts that were assigned to 5 agents with each agent receiving 2 accounts. I would know like to randomly reassign the accounts with the only criteria being that the random allocation not reassign to the same agency and each agent gets 2 accounts again.
Data looks like below and I want to populate the randomly assigned agent in the "Second_Agent" column.
How can we use the SQL INSERT statement in the stored procedure to create a table in a user specified filegroup? Table1 will be created by using the following SQL script and will be placed in a default filegroup. The question is can this table been created in a specified filegroup other than default filegroup.
INSERT INTO Table1(col1,col2) SELECT col1,col2 FROM Table2
Example, userA table assign to userA filegroup. userB table assign to userB filegroup. Usually by using CREATE statement you can put the table on a specific filegroup as long as a predefined filegroup has been hard coded in the script. I appreciate any inputs.
On one of our development ,and production, databases, I have been, through Enterprise Manager for Mssql 6.5, uisng the managerlogin facility to map each login toa specific group for a specfic database via right clickin on the group for the login and changing it. This s being doe for moving a login for public to a read-only group.
I have done this for about 40 users. Users are being added quite often now. This is obviously a labor-intensive and time-consuming manner of doing things.
!) Does any one have a script to change the associaed group for each login in a particular database? If not, how could I built a script from the system tables?
2) Does any one have a script which would tell me, and generate output on, which users have which permissions on the tables in a database and what group are they associated with?
Thanks. Any information you can provide will be greatly appreciated.
On one of our development ,and production, databases, I have been, through Enterprise Manager for Mssql 6.5, uisng the managerlogin facility to map each login toa specific group for a specfic database via right clickin on the group for the login and changing it. This s being doe for moving a login for public to a read-only group.
I have done this for about 40 users. Users are being added quite often now. This is obviously a labor-intensive and time-consuming manner of doing things.
!) Does any one have a script to change the associaed group for each login in a particular database? If not, how could I built a script from the system tables?
2) Does any one have a script which would tell me, and generate output on, which users have which permissions on the tables in a database and what group are they associated with?
Thanks. Any information you can provide will be greatly appreciated.
This question is regarding a brand new out-of-the-box SQL Server 2005 Workgroup Edition install. The old SQL Server 2000 server is working properly with regard to the issue we're having:
We are using Windows Authentication, and have created SQL logins for about
40 different groups on our domain. We've given those logins the appropriate
permissions on the databases they're supposed to be able to access. The SQL Server is not a domain controller, but is a member of the domain, and domain logins do work for Windows-login purposes on this box.
The problem is that when users try to connect to the SQL server, they are denied access. An error 18456 is thrown, and logged in the Application event log
stating "Login failed for user OURDOMAIN heuser" (example values). The
domain user is properly a member of group added as a login to SQL Server, and we've confirmed that there are not conflicting permissions that would deny those
users access via another route. These same groups are working fine on the SQL Server 2000 box.
This is only a problem for domain-based groups. If we create a local group
on the SQL server machine, through Computer Management -> Local Users and
Groups, then make the same domain users a member of THAT group, and finally then follow the same process to add that local group to SQL Server Logins and set
the database privileges, it works!!
Our group memberships change frequently, and are used for a lot more than
just SQL server permissions. So, using local groups and maintaining
membership in both places is not really feasible. Any ideas why a local
machine group containing domain user accounts would work fine, but a domain
ok, first, I know... I forgot to run a backup of the master database, and I forgot to run a script to caputure logins. Not that that is out of the way... I need to recreate the logins under the Securities tab below the databases. All the company databases have the user names and passwords assigned to them, but they are not able to login, because they are not able to authenticate to the SQL server first.
Is there a script that someone has that will copy the company database security info for the users and recreate them in the SQL security tab?
I know that I can rebuild them manually, but I need to delete them first in the application software, then delete them from the databases, and then recreate them in the application software... and as simple as that sounds... it is a slow moving process.
I would move a Database to another server. I try to use DTS but I have problems with this process because DB have big tables, I think. I try to use DETACH and ATTACH procedures but logins doesn't export. And more, in new server there are already logins from another DBs.
What's the best way to solve this problem? Please, help Thanks
I am a systems analyst and work with an app that runs against 2 SQL Server DBs. Though I have some familiarity with SQL Server and SQL, I am not a DBA.
The app executable is tied to a Windows service. When we install the app, we run a process that builds 2 dbs to include: Tables, indexes, stored procedures, views and user accounts. SQL Server is set up for mixed mode authentication.
Normally, the dbs run off the local db user accounts which are tied to local logins with the same names. We have a client that wants to remove our standard logins so that they can run on only a Windows login. I know I should be able to tie the db users to a Windows login. And I can do the same for the service.
But I am at a loss as to how to get this done. How do you associate db users with a Windows login? When I have tried sp_change_users_login I get an error that the Windows login does not exist. (Though I have added the Windows account to the DB.)
I have an SSRS 2012 table report with groups; each group is broken ie. one group for one page, and there are multiple groups in multiple pages.
'GroupName' column has multiple values - X,Y,Z,......
I need to group 'GroupName' with X,Y,Z,..... ie value X in page 1,value Y in page 2, value Z in page 3...
Now, I need to display another column (ABC) in this table report (outside the group column 'GroupName'); this outside column itself is another column header (not a group header) in the table (report) and it derives its name partly from the 'GroupName' Â values:
Example:
Value X for GroupName in page 1 will mean, in page 1, column Name of ABC column must be ABC-X Value Y for GroupName in page 2 will mean, in page 2, column Name of ABC column must be ABC-Y Value Z for GroupName in page 3 will mean, in page 3, column Name of ABC column must be ABC-Z
ie the column name of ABC (Clm ABC) Â must be dynamic as per the GroupName values (X,Y,Z....)
Page1:
GroupName          Clm ABC-X
X
Page2:
GroupName          Clm ABC-Y
Y
Page3:
GroupName          Clm ABC-Z
Z
I have been able to use First(ReportItems!GroupName.Value) in the Page Header to get GroupNames displayed in each page; I get X in page 1, Y in page 2, Z in page 3.....
However, when I use ReportItems (that refers to a group name) in the Report Body outside the group,
I get the following error:
Report item expressions can only refer to other report items within the same grouping scope or a containing grouping scope
I need to get the X, Y, Z ... in each page for the column ABC.
I have been able to use this - First(Fields!GroupName.Value); however, I get ABC-X, ABC-X, ABC-X in each of the pages for the ABC column, instead of ABC-X in page 1, ABC-Y in page 2, ABC-Z in page 3, ...
Hello everyone, i have the parameter in my stored procedure that i am using as a sqldatasource.
Now in one of the events, i need to assign a value to the parameter. How can i do that? Microsoft is changing the syntax so often, all solutions i found on this forum just don't work anymore, like: SqlDataSource1.SelectParameters["@CompareInteger"].value= "1" OR SqlDataSource1.SelectParameters["@CompareInteger"].DefaultValue= "1"
I guess the SelectParameter - became 'ReadOnly'..But how to assign value to a parameter now?!? Thanks for any help
I use SQL Server 2005 and in a Stored Procedure I want to execute a sql statement and assign the result to a variable. How can I do that?The name of the column I want to retreive the value from is "UserID"Here's my SP so far: ALTER PROCEDURE [dbo].[spUnregisterUser] @UserCode int AS BEGIN SET NOCOUNT ON; declare @uid uniqueidentifier --get userid SELECT @uid=UserID FROM tblUserData WHERE UserCode=@UserCode -- Delete user UPDATE tblUserData SET IsDeleted='True' WHERE UserCode=@UserCode END
I have this query and I tried this but am getting the error for the case statement when I assign the nulls to a 0:
The error is they data types of the result expression of a CASE expression are not compatible.
SELECT 'C' as account, FUND_dim.fund_cde as FUND, case when sum(BRKGRPTT.daily_brkg_fact.accum_unit_cnt) is null then '0' else sum(BRKGRPTT.daily_brkg_fact.accum_unit_cnt) end as Units_Purchased FROMFUND_DIM left outer join BRKGRPTT.daily_brkg_fact on FUND_DIM.FUND_ID_NUM = BRKGRPTT.daily_brkg_fact.FUND_ID_NUM and BRKGRPTT.daily_brkg_fact.SEP_ACCT_ID_NUM <> 1 left outer join SEP_ACCOUNT_DIM on BRKGRPTT.daily_brkg_fact.sep_acct_id_num = SEP_ACCOUNT_DIM.sep_acct_id_num group by BRKGRPTT.sep_account_dim.sep_acct_cde, BRKGRPTT.fund_dim.fund_cde order by FUND_dim.fund_cde
How do I assign XmlDocument results to a variable (so that I can pass it to a sp)?
I know that the following code works....
select * from tblUsers where userId = 1225 for XML raw
It returns "<row UserId="1225" LastName="Evans" FirstName="Stephanie" MiddleInitial=...."), which is what I want. But when I try to assign it, I get an error "Incorrect syntax near 'XML'."
declare @strXml nvarchar(1000)
set @strXml = (select * from tblUsers where userId = 1225 for XML raw)
I'm developing a vb 2005 application and I€™m creating the users directly to the database. I want to assign them names.
I want to do something like this: CREATE TABLE admin.db_users ( id INT CONSTRAINT db_user_pk PRIMARY KEY, [name] VARCHAR(50) CONSTRAINT db_user_name_nn NOT NULL, authentication VARCHAR(25) CONSTRAINT db_user_authentication_nn NOT NULL, CONSTRAINT db_user_fk FOREIGN KEY(id) REFERENCES sys.database_principals (principal_id) ON UPDATE CASCADE ON DELETE CASCADE ); GO
This is the error that i'm getting: Msg 1767, Level 16, State 0, Line 1 Foreign key 'db_user_fk' references invalid table 'sys.database_principals'. Msg 1750, Level 16, State 0, Line 1 Could not create constraint. See previous errors.
How do I solve this problem or how can I do something similar.
I've posted a feedback with Microsoft to see if we can get them to fix the issue described below, but so far no one from Microsoft has commented to let us know what they're doing about this problem! I'm posting this here to see if maybe we can get more people to rate this feedback or chime in on what a pain it is! Please feel free to add your own comments or how you had to work around this issue and whether or not you think this is something Microsoft should be addressing NOW.
Provide Individual Page Numbering per Group and Total Pages per Group
Currently in a Reporting Services report, you can't readily reset the page number for each group in a table, nor can you display the total number of pages per group. For example, if I'm printing invoices and each invoice is a separate group, I'd like to be able to print "Page 1 of 5" , "Page 2 of 5" etc. for the first invoice, then "Page 1 of 3" when the next invoice begins, and so on. This was easy in Crystal Reports. I realize that Crystal Reports has a two-pass process that enables that kind of pagination. However, this is REALLY important functionality that's just missing from Reporting Services and I'm hoping you'll provide it REALLY SOON! Yeah, I know there are work-arounds if you can know exactly how many rows of information there are on each page. But gosh! That's not practical, especially if you have second level groups inside the main group or text blocks in rows that can 'grow' to more than one line. I've read a couple of work-arounds, but none of them works correctly and consistently when more than one user is running the same report or when you print the report while you're looking at it on the screen. I still may need access to the overall report page number and the overall total number of pages, so don't get rid of that. It's just that if you're doing this already for the entire report, I don't see why you can't do it per group! Lots of people have been asking for this for years, and I don't understand why it hasn't been implemented.
I've read a few articles on this topic, but no one has come up with a decent work around. My theory is that Microsoft should be addressing this immediately. This is major functionality that's just plain missing from SSRS and should have been there from the start. If anyone from Microsoft can let us know what's going on with this issue or if anyone would like for me to clarify this further, feel free to let me know.
I have an SSRS report with groups that when exported to excel contains drill-in's (plus marks on left side). The issue I have is that for all the groups in the drill-in, those cells become merged. I want to keep the group drill-in but have the cells UNMERGED. I have heard this can be done with the RDL XML but I don't know what to modify to accomplish this.Â
Hi My webpage contain three dropdown box and one button. One dropdown to choose hospital_id, second dropdown to choose project_id and third dropdown to choose version_no .After choosing these three and when the button is clicked i want to run this sql query INSERT INTO version(project_id,hospital_id,date_created,comments) SELECT project_id,hospital_id,date_created,comments FROM version where version_no=@version_no and project_id=@project_id and hospital_id=@hospital_id. Just i need the code in asp.net 2.0 , VB , when the button is clicked the above query should run and the parameters (values) should take from dropdown box. Could anyone please send the solution for the above problem.
hi everybody I have the following asp.net2.0 codeSelectCommand = "Select IDEmp, FirstName,MiddleName,LastName, Date,HoursNumber, Description From Employee, WorkOnCategory , CatDesignItemReference where IDEmp =IDEmplWork AND FirstName = @FirstName AND Category = @AnyCategory AND ">
The problem is that the AnyCategory in my DropDownList1 refers to a key but unfortunalely my code understand it as string so it assigns Category = @AnyCategory as if Category ='AnyCategory ' not as Category = AnyCategory So what should I do Thanks
myConnection.Open() Dim myPuzzleCmd2 As New SqlCommand("GetRandomCode", myConnection)
myPuzzleCmd2.CommandType = CommandType.StoredProcedure Dim retLengthParam As New SqlParameter("@Length", SqlDbType.TinyInt, 6) retLengthParam.Direction = ParameterDirection.Input
myPuzzleCmd2.Parameters.Add(retLengthParam) Dim retRandomCode As New SqlParameter("@RandomCode", SqlDbType.VarChar, 30)
Try Dim reader As SqlDataReader = myPuzzleCmd2.ExecuteReader() myPuzzleCmd.ExecuteNonQuery()Catch ex As Exception
myPuzzleCmd2 = Nothing Session.Remove("RandomCode") HttpContext.Current.Session("RandomCode") = myPuzzleCmd2("@RandomCode") < --------- Over here Finally myConnection.Close() End Try
Hi I have add one new database mdf file in my project by ---> add new Item in to project. But This database.mdf file is in windows authetication mode. So there is no password assign to this. I want to assign use id and password to this database or I want to give sql server authetication mode. I have tried Modfy Connection property of database but that is not working. what is the default username of this conncetion????? REply.....
I am trying to automatically insert records into my existing customer table. Is there a way when I insert these new records and assign the customer number that it can sequentially pick the next available unique customer number for each record that is inserted? for example the first record would be customer number 100, the next 101, and so on? Please advise.
I have the qry, which is suppose to assigned records to active user (almost 15 users) equal, but it doesn’t- sometime it assigned more to some users and less to others. How could I modify my qry to make sure it assigns the records equals to each user? Please, see the qry below. I will appreciate any help
Thk
UPDATE TBLFRAUDFINDER SET DATE_ASSIGNED=GETDATE(), FRAUDANALYSTASSIGNED=@FRAUDANALYST WHERE FRAUDID=@FRAUDID OR (FRAUDANALYSTASSIGNED IS NULL AND ((INQUIRY_GOVT_NUMBER=@INQUIRY_GOVT_NUMBER) OR (CUST_NM=@CUST_NM) OR (ALERT_IDENTIFIER=@ALERT_IDENTIFIER) OR (ACCT IN (SELECT ACCT FROM TBLFRAUDFINDER WHERE INQUIRY_GOVT_NUMBER=@INQUIRY_GOVT_NUMBER OR CUST_NM=@CUST_NM OR ALERT_IDENTIFIER=@ALERT_IDENTIFIER))
Here is my issue. I have a list of merchants (generated daily) and Ineed to assign them eually to a set of analysts. Both the merchantlist and analyst list can change daily. I want to assign each merchantwith an analyst daily and need help to write out a stored procedurefor this (do not want to use VB).Here is relevant code for the tables:CREATE TABLE MerchList (MerchListID int IDENTITY (1, 1) NOT NULL ,FileDate datetime NOT NULL ,MerchID int NOT NULL ,AnalystID int NOT NULL ,)CREATE TABLE tblAnalyst (AnalystID int IDENTITY (1, 1) NOT NULL ,AnalystName varchar(100) NOT NULL)there will be about 10000 records in table MerchList and around 25records in table tblAnalyst.This will be used to assign work to analysts on a daily basis.Thanks for all your help!Vishal
I am trying to achieve a seemingly simple task of assigning datetime value to a user variable at the point my package starts running. How can I do this without using a SQL Script Task? Should I be using a script task for this or is there a simpler way to achieving the same thing?
im using the Northwind database, i use T-SQL commands to create a view that restricts users from seeing the address, city for all employees. i dont know how to assign the view to a user in the database using Enterprise manager. pls help me, im really needing a answer. thanks!
I deployed a clustering project. As a result, I got 10 clusters. Is there an automatic way to create a table with the customer ID and the cluster # that each customer was assigned to?