I want to create a new schema in SSMS with the Schema - New dialog box but I can't find how.
I know it's supposed to open when I right click on the Databases/xyz/Security/Schemas folder in the Object Explorer and select New Schema... but all I get is a query to create it.
I just started an edX course called Developing SQL Databases, there are no instructions there concerning the SSMS settings, the only instructions say that I should be able to get the Schema - New dialog box. I asked there in the discussion but nobody replies, actually there's no activity there whatsoever so probably nobody even knows I asked.
I did google it but the only relevant results I found say the same thing, right-click, New Schema... and the dialog box opens. But it doesn't.
So, what am I missing?
Expand the database in the Object Explorer, and right-click the Security folder, then select "New" (the Security folder under the database, NOT the Security folder under the server).
I realize your question is how to do this in SSMS, but the tsql code for this is only five words.
create schema MyNewSchema authorization dbo;
That seems much simpler to me.
Be sure you are searching in a right folder.
the security folder is under the database , not under the server.
as next screenshot:-
UPDATE:-
This issue is repeated here, and the soluation was the following:-
Full uninstall Manual
deletion of all MSSQL-folders in
AppData{Local|Roaming}
Reinstall
Checking for any updates
and everything is as expected, so try these steps.
Related
A little bit of an odd issue here.
I have a database, hosted on SQL Server 2008 R2 (SP2), that has 10 different schemas that could be used for reporting purposes:
Please note, for company compliance reasons, I did redact this image to the bare essentials.
Now, when I go to create a report, and connect to the database in question, the only schemas that are presented to me are those starting with lm_:
Again, redacted...
Now, for the purpose of the report I need to build, I need to be able to select against tables that are in one of the ls_ schemas.
My question is, in Crystal Reports 2013, how do I make all available schemas visible for use in a report?
Other important things to note:
I am able to log into SSMS as the same account I am using to connect to the database in Crystal Reports, and am able to successfully run queries against the schemas in question.
The account I am connecting to the database as, in both SSMS and CR, has full administrative access/capabilities against all schemas in the database in question
Points 1 and 2 would suggest that this is not a security related issue
I am connecting to the database in CR through an ODBC connection created on my system through ODBC Data Source Administration (32-bit) - as a System DSN
The ODBC Data Source uses the same administrative account being used directly in CR and SSMS
Thank you in advance for your help. Please let me know if there is any additional information that I can provide to help solve this issue.
I faced similar issue few years back, and as per my experience it has nothing to do with database and it is within the crystal reports where a registry value is set to minimum value which will restrict the display of schemas or tables
Check below link which will show you the path to change registry.
forumtopics.com/busobj/viewtopic.php?p=1004707
I would suggest you to first take back up of the original data and then change the value
Maybe this:
On the menu bar, select File –> Options.
Click the “Database” tab.
Uncheck the “Stored Procedures” option.
Someone on another forum said that worked but he did not know why.
There is a setting in Crystal under File-->Options-->Database where one can set owner like %. Perhaps your Crystal install has an old setting limiting your visible schemas?
For any one in 2022 who is facing this problem. Check the following:
Open odbc, 32 bits odbc.
Select your datasource and click configure
Click details
Select Metadata tab
Uncheck Disable Schema support and click Ok.
Solved, this is tested and working
I created SSIS packages and used the Integration Services Deployment Wizard to deploy it out to the server. I'm manually going to the Integration Services Catalog access through SQL Server 2012 and right-clicking and executing my package.
However, the package keeps failing and I'm getting the following errors when I check the execution report's messages.
They appear to be failing on data tasks where I have script components.
Assign :Error: CS2001 - Source file 'C:\Windows\TEMP.NETFramework,Version=v4.0.AssemblyAttributes.cs' could not be found, CSC, 0, 0
Assign :Error: Failed to compiled scripts contained in the package. Open the package in SSIS Designer and resolve the compilation errors.
This answer is a more detailed version of UberDoodles answer.
In Windows Explorer.
Navigate to C:\Windows\Temp\
Right click the folder and select properties
Go to tab Security, choose Advanced
On the default tab Permissions, choose Change Permissions
For the relevant Permission entry, choose edit.
By default, I had 'allow' checked for Traverse folder / execute file, Create files / write data and Create folders / append data.
Also check 'allow' for List folder / read data and Take ownership.
Press OK, the window closes
Press Apply and confirm anything you need.
Additionally, the logged in user had already Full control, but when I changed this for the entry 'Users', it worked for me.
(based on microsoft file/folder permissions).
I had the same problem today, just on SQL 2016.
For me it helped to change the target server version in Visual Studio project properties from SQL Server 2012 to SQL Server 2016.
I was investigating the same issue, and I came across a solution here :
https://social.msdn.microsoft.com/Forums/vstudio/en-US/73e67f3a-c575-4c73-a71d-ed7a2aeabb50/csc-error-cs2001-source-file-cwindowstempnetframeworkversionv40assemblyattributescs?forum=msbuild
Basically, the account which the package runs under needs to have full permissions to the C:\Windows\Temp\ folder, so that it can create temporary classes.
It worked for me :)
I had the same problem. I first used Eric G. response and added the List and Read permission to the c:\windows\temp. After I got everything working I went back and removed that permission. I then redeployed my solution from Visual Studio, this time designating the deployment target as SQL Server 2014 (which was the environment I was using) using Martin's solution. I then reran the process, and it worked with the List and Read removed.
I kept it using Martin's solution, as I don't like to have special permissions granted if I don't need them.
Good Luck
[Visual Studio 2017 15.9.16]
I just restarted Visual Studio as Administrator and the issue disappeared, which confirms the permissions idea of the answers above but spared me all work.
It's not a quirk though, as per this question and its answer you need that kind of permission for several tasks, like profiling and debugging under certain conditions.
For the sake of completeness, this blog says you might incur in some security contraindication if run VS as administrator when opening third-party solutions.
I have numerous scripts to run in SQL Server.
Currently I've made many scripts which have been saved as file and can be loaded in SSMS when needed.
I want to know if we have any shortcut(bookmark) in SQL server to script files.
So far I've found nothing on internet. (note that creating stored procedures for these ad-hoc scripts is not an option)
By pressing Cntrl+K, Cntrl+W combination you can see the Bookmark manager.
Here you can see all bookmarks in locally saved sql queries.
Like in the below screenshot I have a bookmark for getLocationBasedMemberVisitsData.Sqlfile.
On how to add a bookmark
goto Edit>Bookmarks>toggle bookmark when you are inside your file with your edit cursor at the line you want to bookmark
P.S.: You can also create a folder hierarchy much like in browsers like Chrome
Store all needed files inside a single solution. Call it Utilities. Much like VS you can browse through the solution files using Solution explorer.
Caveat: The bookmarks on loose sql files are not persisted. So on a restart(close/open) for SSMS tool these are lost.
If you do need to persist bookmarks, create bound files i.e. store the files in a solution first.
Also the bookmarks in Management Studio are consist with Visual Studio.
Addendum:
Based on asker's comment
This just bookmark a line on a script. Is these any way to give these bookmarks a name?
You can rename both the folders as well as bookmark name by double clicking on it or by right click>rename option
On another comment
What do you mean by saving as as solution. I cannot find such option in SSMS. Are you referring to VS?
SQL server management studio like VS supports creation of Solutions(project) which are essentially collection of related queries/SP with connection information and other needed stuff.
To create a new solution press cntrl+shift+N. see screen shot below
Any bookmarks on solution files are sticky. Next time you open the solutions, bookmarks are presented back to you.
The SQL solution can be opened in VS too. The bookmark information along with other user information is stored in a *.ssms_suo file much like a *.suo file of VS.
It is a good idea to store all helpful files in a utilities solution which can be open all the time so that you can easily access it.
I think a Snippet is what you are asking for:
A Transact-SQL.code snippet is a template containing the basic
structure of a Transact-SQL statement or block. You can use snippets
as a starting point when adding statements in the Database Engine
Query Editor. You can insert the pre-defined snippets supplied with
SQL Server, or create your own.
more info here
In SQL Server Management Studio you could use menu -> Tools -> External Tools.
Do you use SQL Prompt? If so, this has a Tab History feature that lets you search for query windows, regardless of whether they have been saved or not.
If not, I'd use the snipppet feature that VV5198722 has referred to, or the Template Browser (invoked from the view menu).
I got a SSRS 2008 web edition instance (which was migrated from 2005 standard edition) and I need to change some security for a new folder I`ve just created.
When I go on report server web page (http://rsServerName.xyz/Reports), enter the new folder, go on folder properties, then when I click on Security, web page returns an error The user or group name 'xxx' is not recognized. (rsUnknownUserName)
I`ve checked the user in database - it exists, it has some items (reports) assigned to it, seems fine just like other users from database.
I first thought to just go into database and remove the entries from PolicyUserRole for users that aren't allowed into that folder, but there's also some info in SecData, and maybe some other places, and also found that microsoft doesn't support any queries against their reportserver database, so that might not be the brightest idea :)
Does anyone know any other way to remove the security from a specific folder ? Or maybe things to look at for this user name that it fails ? Another thing to mention, all security problems started when server was migrated from 2005 standard to 2008 web edition.
Thanks.
The only possible way to fix this was to remove the user completely and add it back. During the migration described above several user's permissions were affected, and the only way to fix was to re-create them from scratch - not elegant, but worked.
Solution - find the user, remove, add back.
I have a database in a local file that is used by a program. The program has limited functionality and I needed to run some quick queries. I installed SQL Server Management Studio Express 2005 (SSMSE), connected to the SQL Server instance, attached the database file, and ran the queries. Now the original program will no longer connect to the database. I receive the error:
Cannot open user default database. Login failed. Login failed for user 'MyComputer\MyUserName'.
I've gone back into SSMSE and tried to set the default database. I've opened up Security, Logins, BUILTIN\Administrators and BUILTIN\Users. Under General, I have set the default database to the program's database. Under User Mappings, I made sure the database is ticked and that db_datareader and db_datawriter are ticked.
The program uses the connection string:
Server=(local)\Instance; AttachDbFilename=C:\PathToDatabase\Database.mdf; Integrated Security=True; User Instance=True;
I know jack-all about database administration. What else am I missing?
This may not be answering your question specifically, but it may help others with similar issue caused by different problem
In my case the problem was my user is defaulted to a database which is not accessible for any reason (can be renamed, removed, corrupted or ...)
To solve the issue just follow the following instruction
Try to login again on the login page there is other tabs select
"Connection Properties".
under the tab locate "Connect to database" and select an existing database you have access to like tempdb or master
Once you are connected to the SQL Server Instance execute the below TSQL to assign the login a new default database.
Use master
GO
ALTER LOGIN [yourloginname] WITH DEFAULT_DATABASE = TempDB
GO
Alternatively once you connected change your default database name to master via UI
Article taken from :
http://www.mytechmantra.com/LearnSQLServer/Fix-cannot-open-user-default-database-Login-failed-Login-failed-for-user-SQL-Server-Error/
This problem manifested for me when I took my default db offline. Next thing I know I couldn't login. Switching to the Connection Properties tab and selecting the drop down to change the database I want to connect to also failed.
It let me in right away once I manually typed master as the db I wanted to connect to (on the Connection Properties tab).
First, try to isolate your problem:
Take a backup of the file! Some of the steps below can, apparently, in some circumstances cause the file to vanish.
Are you sure you are connecting to the same instance through Management Studio as the program is?
If possible, try to shut down the instance that you are not expecting to use.
Set the user's default database to master and try to make the program logon.
Try to login as the user through Management Studio - since you have integrated security, you should open Management Studio as the program's user.
Are you using "User instances" - perhaps without knowing it? If so, this may be helpful: http://blogs.msdn.com/b/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx
I haven't worked much with files being attached in the way your program does - but you write that you attached the DB in the Management Studio as well. Have you tried detaching it there before running your program? Perhaps you are seeing the Management Studio and your program competing for exclusive access to the MDF-file?
EDIT: I added point 6 above - this is new in my own list of TODOs when troubleshooting this type of Login failed. But it does sound a lot like what you're experiencing.
EDIT2: In the first edit, new item was added to the list. So the numbers in the comments doesn't correspond with the numbers in the answer.
I finally figured this out, and my situation is different than every other I've read about tonight.
I had restored my database from a backup. I knew that there was a particular login user that I had been using, so I created that user in SSMS. However, there was already a user by that name under the database that had come in with the backup.
Since I had screwed around so much trying to fix this, I wasn't able to delete the user under the DB easily. I deleted the database and restored again. Then:
Delete the user under the Databases->[my database]->Users
Create the user again in Security->Logins (not under your DB, although that probably works too.
Go to the newly created user. Select properties. Then under User Mappings, tell it to make your database the default. Give it read and write access.
Summary: I had two users. One that came with the DB, and one that I had created. Remove the one that came with the DB and create your own.
First click on Option>> Button of “Connect to Server” Prompt.
Now change the connect to database to any existing database on your server like master or msdb.
More Details
https://blog.sqlauthority.com/2008/11/04/sql-server-fix-error-4064-cannot-open-user-default-database-login-failed-login-failed-for-user/
I've also had this same problem, it turned out that I was trying to access the built in membership classes (in a view), and that .Net was trying to create the database in the App_Data folder:
#Membership.GetUser().ProviderUserKey
This will trigger the system to try and create a database based in the built in membership system, which may not be the way your system is setup.
I had a similar problem had to simply download SQL Express Utility that is capable of starting User Instances. SSEUtil is a tool written by the Visual Studio team to help troubleshoot User Instance issues, you can read more about it in the read me file that is installed with the utility.
http://www.microsoft.com/downloads/details.aspx?FamilyID=fa87e828-173f-472e-a85c-27ed01cf6b02&DisplayLang=en.
Hope this will help.
In my case I had to set "connect to any database" right path:
On your instance, go to Security , then to Logins.
Right Click on there, you will see properties and you should click on Securables.
There it give possibility to connect to any database.