ssms

ROW_NUMBER() in a view in SQL Server 2005

本小妞迷上赌 提交于 2019-12-11 20:18:06
问题 I have tried the following query in Microsoft SQL Server Management Studio: select ROW_NUMBER() OVER(ORDER BY ret_id, dep_id DESC) AS 'Row Number' from Round_Trip_View and it works. I have tried the same to create a view, and it crashed. Any idea? I am looking to assign a kind of id for each row in my view and I appreciate any alternative ideas :) 回答1: The problem was the view wizard. What I learned: never use the wizards when you can code! :) 来源: https://stackoverflow.com/questions/13280520

Launching SQL Server 2008 Express from VS2010 in SQL Server Management Studio

[亡魂溺海] 提交于 2019-12-11 18:42:25
问题 My laptop has Windows 7, x64 bit, and was built this past December (2 months ago). It has Microsoft Visual Studio 2010 installed with SQL Server 2008 Express , but I had not used "Sql2008" before on this PC. SQL Server Management Studio has been installed all that time, and I use it to connect to our company's instance of SQL Server. Now, I need to do some development and debugging on a large stored procedure that is not returning the data we expect. I got a backup of the database companyDB

SQL: How to sort values into categories in ssms

筅森魡賤 提交于 2019-12-11 18:34:10
问题 i create the query SELECT Dt, CustomerName, ItemRelation, SaleCount, DocumentNum, DocumentYear, IsPromo, CustomerType FROM [dbo].[promo_data] where [CustomerType]='XY' there is data on the stock [IsPromo] (0-no stock, 1 is a stock) how can i select only these obs XY of CustomerType which have only one value 1 for the action category = 1 simple example [ItemRelation] [SaleCount] IsPromo ,[DocumentNum] [DocumentYear] 11203 8,85947691 0 138 2018 11203 9,450108704 0 138 2018 11203 12,40326767 1

How to set BEGIN_TRANSACTION automatically in SSMS (SQL Server Management Studio)?

旧城冷巷雨未停 提交于 2019-12-11 18:30:00
问题 With Options > Query Execution > ANSI > SET IMPLICIT_TRANSACTIONS , each batch is not committed automatically. Even so, I have to run begin transaction in batch explicitly, i.e. if I just run update table_name set col_name = 'something' without the begin trans , the update is automatically committed, can I actually ask set up SSMS such that it will automatically create a transaction when I execute a update\insert\delete batch? 回答1: I think the IMPLICIT_TRANSACTIONS setting works the way that

Powershell secure string conversion

青春壹個敷衍的年華 提交于 2019-12-11 18:00:16
问题 Hi I am trying to do this Import-Csv C:\sl.csv |$pass = convertto-securestring "abc123"-asplaintext -force | ForEach-Object {New-Item $(Encode-Sqlname $_.Name) -ItemType Registration -Value ("server=$($_.Name);integrated security=true") -Credential (New-Object System.Management.Automation.PSCredential("sa", $pass)) } but getting error like this Expressions are only allowed as the first element of a pipeline. At line:1 char:29 + Import-Csv C:\sl.csv |$pass <<<< = convertto-securestring "abc123

Eliminating NULL rows in TSQL query [duplicate]

时间秒杀一切 提交于 2019-12-11 16:50:26
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: How to eliminate NULL fields in TSQL I am using SSMS 2008 R2 and am developing a TSQL query. I want just 1 record / profile_name. Because some of these values are NULL, I am currently doing LEFT JOINS on most of the tables. But the problem with the LEFT JOINs is that now I get > 1 record for some profile_names! But if I change this to INNER JOINs then some profile_names are excluded entirely because they have

SSMS and sp_OAMethod: is there a Data Type greater than VARCHAR(8000)?

僤鯓⒐⒋嵵緔 提交于 2019-12-11 15:56:17
问题 Calling a REST service through SSMS is indeed not a great idea. BTW since Microsoft created the Stored Procedure sp_OAMethod and even Phil Factor from Red Gate show us how to use it I wanted to give it a go. I wanted to import some data from OpenStreetMap directly into MSSQL, so I copy a good query from here and I adapt it to my whish. In this example I'm returning all Cinemas in Nelson : DECLARE @obj AS INT DECLARE @Uri AS NVARCHAR(4000) DECLARE @Response AS VARCHAR(8000) SET @Uri = 'http:/

Either the user, 'IIS APPPOOL\App Name', does not have access to the 'SSAS Cube Name' database, or the database does not exist

孤街浪徒 提交于 2019-12-11 15:08:39
问题 1st - I deployed the cube to localhost using SSAS (SQL Server Analysis Services) 2nd - I verified the cube database exists using SSMS (SQL Server Management Studio) even tough the SSAS DB is not showing in SSMS 3rd - I tried to grant permission to my IIS APPPOOL following this answer 4th - I added a new connection in SSMS to Analysis Services in localhost server (instead of a connection to the database engine in the localhost server) 5th - I realized that the process for granting permissions

Script to automatically open SQL Server Management Studio 2005 from another interface

故事扮演 提交于 2019-12-11 12:37:21
问题 Please I need help with a script that can help me open the SQL Server Management Studio 2005 from a button in an another interface. Thanks Roger 回答1: sqlwb.exe is SSMS in SQL Server 2005 and it has parameters such as -S etc for Server name, but also has a filename parameter. At command prompt, run sqlwb /? to get command line usage 回答2: With C#: using System; using System.Diagnostics; void StartStudio() { Process proc = new Process(); proc.StartInfo.FileName = "ssms"; proc.Start(); } 来源:

Create custom menu item in Object Explorer

社会主义新天地 提交于 2019-12-11 12:10:07
问题 Basic question is how to create custom menu items in Object Explorer in Sql Server Management Studio ? Actually what I want to implement is create menu item which will perform as: Create CRUD stored procedures for the table on which the user had done right-click. Possibly other stuff like remove duplicate records. The executing module could be external written in C#.NET I have checked SSMS Addins but I think it is different than what I am looking for.. (please correct me if I am wrong) I hope