ssms

How to retrieve data from SQL Server based on below example?

你说的曾经没有我的故事 提交于 2019-12-01 10:42:01
问题 Actually I posted a similar question related to this in here How to retrieve data from SQL Server as required below? and now I needed some changes in that so please see this before suggesting I have a table like this : CustName Country RecordedTime --------------------------------------------- Alex Australia 2018-Jun-01 08:00 AM Alex China 2018-Jun-01 10:00 AM Alex Japan 2018-Jun-01 11:00 AM John Australia 2018-Jun-01 08:00 AM John China 2018-Jun-02 08:00 AM Bob Australia 2018-Jun-02 09:00 AM

Incorrect syntax near ']'.?

不羁的心 提交于 2019-12-01 10:25:05
问题 I have done some debugging on my sql and I cant figure out the maddening error I am getting I have narrowed it down to a couple of lines which I cant see what the problem is, please someone give me some assistance. I get this error I am here2 Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ']'. I am here3 Print 'I am here2' SET IDENTITY_INSERT c365online_script1.dbo.tCompany ON declare @cols2 varchar(max) select @cols2 = (Select Stuff((Select '],[' + C.COLUMN_NAME From INFORMATION

How can I see where the tab stops are in the SQL Server Management Studio editor?

我是研究僧i 提交于 2019-12-01 06:15:43
I dictate SQL using speech recognition, and lining things up is a pain. If I could see where the tab stops are it would save me a lot of time. Keith Walton Management Studio supports an undocumented feature that Visual Studio has as well . It adds vertical guide lines to the editor window at specific column locations. Create a .reg file using the text below and open it to merge it with your registry. This will add a line every 8 characters (up to column 96) in SQL Server 2005. Modify as needed to suit your tab size. It does not appear to support more than 12 lines. The RGB portion of the

How to avoid duplicates in the STRING_AGG function

☆樱花仙子☆ 提交于 2019-12-01 05:40:07
问题 My query is below: select u.Id, STRING_AGG(sf.Naziv, ', ') as 'Ustrojstvena jedinica', ISNULL(CONVERT(varchar(200), (STRING_AGG(TRIM(p.Naziv), ', ')), 121), '') as 'Partner', from Ugovor as u left join VezaUgovorPartner as vup on vup.UgovorId = u.Id AND vup.IsDeleted = 'false' left join [TEST_MaticniPodaci2].dbo.Partner as p on p.PartnerID = vup.PartnerId left join [dbo].[VezaUgovorUstrojstvenaJedinica] as vuu on vuu.UgovorId = u.Id left join [TEST_MaticniPodaci2].hcphs.SifZavod as sf on sf

How can I see where the tab stops are in the SQL Server Management Studio editor?

一笑奈何 提交于 2019-12-01 05:35:20
问题 I dictate SQL using speech recognition, and lining things up is a pain. If I could see where the tab stops are it would save me a lot of time. 回答1: Management Studio supports an undocumented feature that Visual Studio has as well. It adds vertical guide lines to the editor window at specific column locations. Create a .reg file using the text below and open it to merge it with your registry. This will add a line every 8 characters (up to column 96) in SQL Server 2005. Modify as needed to suit

SQL Server Management Objects

空扰寡人 提交于 2019-12-01 04:48:50
Am getting the same error on the code below using either trusted or SQL logins: VS2010, Console app .NET4, Win XP. SQL2005 Full. Bombs on the transfer.TransferData ERROR : errorCode=-1073548784 description=Executing the query "" failed with the following error: "Retrieving the COM class factory for component with CLSID {19E353EF-DAF4-45D8-9A04-FB7F7798DCA7} failed due to the following error: 80040154.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. this feels like security. Any

See images in SSMS?

廉价感情. 提交于 2019-12-01 04:07:59
I was browsing around and found this blog post: http://erikej.blogspot.com/2010/04/version-3-of-exportsqlce-now-available.html (It is for a great add in if you user SQL Server CE.) On that post I saw an screen shot of SSMS with images in the results. How is this done? I have images in my database (PNG files that are serialized via memory stream), but I just see numbers when I select the image column. jwhaley58 If you are asking how this is done, I'm not sure how it is implemented exactly. I know that you can create ssms plugins in visual studio, and I'm sure that there is a way to take a

Manually rename tabs in SSMS

烂漫一生 提交于 2019-12-01 04:05:44
I'm always getting confused as to which tab is which in SQL Server Management Studio 2008 R2. I don't find the default naming scheme of tabs very intuitive. Is there a way I can manually rename them? then don't use tabs, switch to window view: from the menu: tools - options in the dialog box, environment - general: click on the "MDI" environment radio button I fought with the tabs and gave up, this works better for me. the tabs just show the first few characters, which ends up being the beginning of the database name, which was usless for me. You can use menu - "window" to see a list of your

What do the different colored bars in the query editor menu mean in SSMS?

◇◆丶佛笑我妖孽 提交于 2019-12-01 03:48:33
What's the significance of the color change in this picture? EDIT: I was referring to the yellow and green areas of the scroll bar. Oded Blue - SQL keywords - query specification components Pink - Functions Grey - SQL predicates Black - table/column names/aliases The colored bars on the left, next to the line numbers, appear next to lines that have been changed since opening the file: Yellow - Changed lines that have not been saved Green - Changed lines have already been saved 来源: https://stackoverflow.com/questions/13055378/what-do-the-different-colored-bars-in-the-query-editor-menu-mean-in

C# Handle on SQL Server Message Output [duplicate]

一个人想着一个人 提交于 2019-12-01 03:43:41
This question already has an answer here: Capture Stored Procedure print output in .NET 3 answers When executing scripts in SQL Server Management Studio, messages are often generated that display in the message window. For example when running a backup of a database: 10 percent processed. 20 percent processed. Etc... Processed 1722608 pages for database 'Sample', file 'Sampe' on file 1. 100 percent processed. Processed 1 pages for database 'Sample', file 'Sample_Log' on file 1. BACKUP DATABASE successfully processed 1722609 pages in 202.985 seconds (66.299 MB/sec). I would like to be able to