sql-server-2012-express

How do I get values for all months in T-SQL

孤者浪人 提交于 2019-12-06 07:41:59
I have a query that I would like to display all months for the year regardless if they have sales for that month or not. I know the issue is with the Group By, but how do I change the query so I don't need it? SELECT ISNULL(MONTH(sd.SBINDT),0) AS MonthSold, SUM(sd.SBQSHP) AS QtySold FROM dbo.SalesData sd WHERE sd.SBTYPE = 'O' AND sd.SBITEM = @Part AND YEAR(sd.SBINDT) = @Year AND sd.DefaultLocation = @Location GROUP BY MONTH(sd.SBINDT) Try this:- SELECT M.Months AS MonthSold,D.QtySold as QtySold FROM ( SELECT distinct(MONTH(sd.SBINDT))as Months from dbo.SalesData sd)M left join ( SELECT MONTH

Silent Install of SQL Server Express 2012 from Inno Setup

大憨熊 提交于 2019-12-04 13:53:35
I am trying to install SQL Server Express 2012 silently from my application installer created using Inno Setup. When running the following command from the command line, SQL Server Express 2012 is installed as I want only showing progress of the install but not allowing the user to enter any input. Command line command that works: C:\Users\Jason\Desktop>SQLEXPR_x86_ENU.exe /ACTION=Install /INSTANCENAME=MYINSTANCE /INSTANCEID=MYINSTANCE /QS /HIDECONSOLE /INDICATEPROGRESS="False" /IAcceptSQLServerLicenseTerms /SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /SQLSYSADMINACCOUNTS="builtin

sql server 2012: cannot alter the login sa

别等时光非礼了梦想. 提交于 2019-12-04 04:49:19
I'm trying to create a database on my local machine using SSMS version 11.0.2100.60. I've run the application as administrator, logged in using Windows authentication, and I've added MYDOMAIN\my-username to the Logins. However if I try to create a db with this login I get the message CREATE DATABASE permission denied in database 'master'. (Microsoft SQL Server, Error: 262) If I try to add the privelage dbcreator to my user, I get the following error. User does not have permission to perform this action. (Microsoft SQL Server, Error: 15247) I can't log in as sa as I don't know/remember the

Hiding databases for a login on Microsoft Sql Server 2008R2 and above [closed]

给你一囗甜甜゛ 提交于 2019-12-03 00:16:04
Please can anyone assist with hiding the available databases on sql server 2008R2 or newer versions. I have a new login user that I mapped to a specific database. When logging in with the specific login user I can see all the databases on the server, although I cannot access them except for the one I mapped to the login. This is 100% but my problem is that I do not want the login to even see that those other databases are available. How do I prevent those other databases that are not mapped to the login from displaying? USE master; GO DENY VIEW ANY DATABASE TO [newlogin]; GO USE yourDB; GO

Connection String Error (error : 40)

孤人 提交于 2019-12-02 20:48:11
问题 I have installed SQL Server 2012 Express on a Windows Server 2008 Machine. The name of the machine is "THEMACHINE". While installation, I set SQL Server 2012 as "Default Instance". Now I set my connection string like this : <add name="BooksContext" providerName="System.Data.SqlClient" connectionString="Data Source=THEMACHINE;Initial Catalog=newdb; User ID=sa; Password=123456"/> But I get this exception : {"A network-related or instance-specific error occurred while establishing a connection

Connection String Error (error : 40)

空扰寡人 提交于 2019-12-02 09:34:40
I have installed SQL Server 2012 Express on a Windows Server 2008 Machine. The name of the machine is "THEMACHINE". While installation, I set SQL Server 2012 as "Default Instance". Now I set my connection string like this : <add name="BooksContext" providerName="System.Data.SqlClient" connectionString="Data Source=THEMACHINE;Initial Catalog=newdb; User ID=sa; Password=123456"/> But I get this exception : {"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct

sql server restoring back up error

耗尽温柔 提交于 2019-11-30 07:49:29
I have backed up a database I had created on an other machine running SQL server 2012 express edition and I wanted to restore it on my machine, which is running the same. I have ticked the checkbox overwriting existing one, and got this error: Backup mediaset is not complete. Files: D:\question.bak. Family count:2. Missing family sequence number:1 This happens if, when you made the backup, you had multiple files listed in the backup destination textbox. Go back to your source server and create the backup again; this time, make sure there's only one destination file listed. If you had more than

Get .sql file from SQL Server 2012 database

可紊 提交于 2019-11-29 22:57:46
I need to get .sql files from an existing database with SQL Server 2012. Is this possible because all I see in the export option is delimited files. Ex.) I have table1 with 30 records. I need a file that would be something like what is below. (I know my syntax is incorrect, but you should get the point). CREATE TABLE table1 ( INSERT INTO table1 values ( .......) If you just want to generate a .sql script you can do this by right-clicking the database in Object Explorer and choosing Tasks > Generate Scripts: Then you can select database and all objects, or you can select just the table you want

sql server restoring back up error

断了今生、忘了曾经 提交于 2019-11-29 10:33:15
问题 I have backed up a database I had created on an other machine running SQL server 2012 express edition and I wanted to restore it on my machine, which is running the same. I have ticked the checkbox overwriting existing one, and got this error: Backup mediaset is not complete. Files: D:\question.bak. Family count:2. Missing family sequence number:1 回答1: This happens if, when you made the backup, you had multiple files listed in the backup destination textbox. Go back to your source server and

Get .sql file from SQL Server 2012 database

夙愿已清 提交于 2019-11-28 17:06:19
问题 I need to get .sql files from an existing database with SQL Server 2012. Is this possible because all I see in the export option is delimited files. Ex.) I have table1 with 30 records. I need a file that would be something like what is below. (I know my syntax is incorrect, but you should get the point). CREATE TABLE table1 ( INSERT INTO table1 values ( .......) 回答1: If you just want to generate a .sql script you can do this by right-clicking the database in Object Explorer and choosing Tasks