ssms

Where are all those SQL Server sessions from?

点点圈 提交于 2019-12-01 16:29:13
After launching SSMS (2008 R2) on my dev machine, which I launch with "D:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe" -nosplash -S localhost -d testdata without doing anything, in Activity Monitor I observe some sessions (TestData is my default database) Details of session 51: select @@spid; select SERVERPROPERTY('ProductLevel'); Details of session 52: DBCC INPUTBUFFER(52) Details of session 53: SELECT CAST(serverproperty(N'Servername') AS sysname) AS [Name], 'Server[@Name=' + quotename(CAST( serverproperty(N'Servername') AS sysname),'''') + ']' + '

Remove the date/time in SQL script generated using SSMS?

假如想象 提交于 2019-12-01 15:34:44
问题 When I generate scripts in SQL Server 2008 Management Studio, it seems to insert the date/time in the script also. For example: USE [AdventureWorks] GO /****** Object: View [dbo].[vw_test] Script Date: 18/01/2017 3:27:10 PM ******/ SET ANSI_NULLS ON GO <rest of script goes here> How can I remove that? 回答1: Tools.. Options.. SQL Server Object Explorer..Scripting Probably need to set "Include Descriptive Headers" = false However, your question is unclear so this is a guess. 来源: https:/

How to enable automatic transaction scoping on SQL Server Management Studio?

吃可爱长大的小学妹 提交于 2019-12-01 15:31:13
问题 I'm used to work with tools like Toad or PL/Sql Developer for Oracle and every SQL statement I run on the query window runs automatically under a trasaction scope. So, if my SQL statement is not correct, or even if I miss something on the SQL script I can rollback only by clicking on a button at the UI. If everything worked as expected, I can click on another button for commiting the current transaction. On those tools I mentioned, I don't need to write SQL statements for begin, commit or

How to set (combine) two primary keys in a table

早过忘川 提交于 2019-12-01 15:03:34
问题 For a small sales related application, we designed database using logical data model. Come to the stage to convert in to physical model. While creating table in SQL Server Management Studio Express, according to our logical data model, we need to combine two attributes to form unique id. Is it possible to combine two primary keys and set it? But while observing Northwind Sample, we found that in the ORDER DETAILS table, we can see two primary keys Order Id & Product Id . And according to rule

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

夙愿已清 提交于 2019-12-01 14:19:22
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 Bob Brazil 2018-Jun-03 09:50 AM Bob Africa 2018-Jun-03 11:50 AM Bob India 2018-Jun-03 12:55 AM If new

Microsoft SQL Service Management Studio 2005 'Script XXX as CREATE To' problem

老子叫甜甜 提交于 2019-12-01 14:06:00
When using the 'Script Index as CREATE To' to duplicate an index from one table to another table I am not able to run the script. Without editing the generated code I get an error. I get the same error when working with any 'Script XXX as CREATE To' generated code. Any comments/suggestions to solve this problem? ERROR: Msg 170, Level 15, State 1, Line 6 Line 6: Incorrect syntax near '('. SCRIPT: CREATE NONCLUSTERED INDEX [IX_IncidentStop_Note] ON [dbo].[IncidentStop_Note] ( [IncidentStopID] ASC, [NoteID] ASC, [Active_Fl] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB

SQL Server Management Studio - Tabbed Documents

佐手、 提交于 2019-12-01 12:57:24
I am working in SQL Server Management Studio. I can no longer see more than one tab at a time. If I have a script open and start a new query, SSMS closes my open script. If I open from file and select multiple scripts; it opens the first, closes it and opens the next, repeatedly until only the final file selected is open. This began yesterday after I played with the dock settings of my query screen. You've probably (somehow) ended up with "Reuse current document window, if saved" ticked, as below: From Tools->Options, Top option on right hand side. Untick it. 来源: https://stackoverflow.com

Protect LocalDB from user access

守給你的承諾、 提交于 2019-12-01 12:53:46
I'm looking at using SQL LocalDB as the client side database which will replace the current SQL CE 3.5 database inside an in-house application developed in .net 4. I've come across a problem that I'm not sure how to get around and that's with security setup of the LocalDB instance. If I setup a script inside .net to create a private LocalDB instance, e.g. (localdb)\T1, then create a new database inside that instance plus add a SQL user account + password (non domain account), how do I stop the local windows users (like my own AD account) with admin level privileges from accessing the 'T1'

Incorrect syntax near ']'.?

老子叫甜甜 提交于 2019-12-01 11:59:43
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_SCHEMA.COLUMNS As C Where C.TABLE_SCHEMA = T.TABLE_SCHEMA And C.TABLE_NAME = T.TABLE_NAME Order By C

Using CROSS APPLY for more than one column

廉价感情. 提交于 2019-12-01 10:53:04
Day #3 with SQL Server. I am trying to combine 2 columns of delimited data into one output from a Table Valued Function. Here is my data: I would like the data to be processed and placed into a table in the following format: I am currently trying to use this CROSS APPLY TSQL statement, but I don't know what I'm doing. USE [Metrics] INSERT INTO dbo.tblSplitData(SplitKey, SplitString, SplitValues) SELECT d.RawKey, c.*, e.* FROM dbo.tblRawData d CROSS APPLY dbo.splitstringcomma(d.DelimitedString) c, dbo.splitstringcomma(d.DelimitedValues) e My research on CROSS APPLY has broad context, and I don