Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 13073

SQL Server 2008 (major build version 10.00.xxxx). Please also tag with sql-server.

0
votes
This returns, for every employee their 2nd last promotion date. select * from ( select *, row_number() over (partition by employee order by promoted_date desc) rn from Promotion ) n …
answered Nov 5 '12 by 孔夫子
1
vote
Indexes are optional on SQL Server tables. In fact, you can add constraints (primary key, unique) within the CREATE TABLE statement but you cannot add indexes at the same time. The indexes come late …
answered Apr 25 '13 by 孔夫子
5
votes
select idTopic, author, deleted, idText, datePosted from ( select t.idTopic, t.author, t.deleted, x.idText, x.datePosted, row_number() over (partition by t.idTopic order by x.datePosted …
answered Nov 13 '12 by 孔夫子
2
votes
While Martin has answered your question completely, I don't see why you would need dynamic SQL here at all. declare @intFlag INT; set @intFlag = 2; SELECT * into [##tmp1] FROM servicesstats_0511_041 …
answered Oct 29 '12 by 孔夫子
4
votes
select s.name, ig.Income_Group, el.Educational_Level, c.Country from StaffName s left join Country c on s.Income_Group = c.ID left join IncomeGroup ig on s.Educational_Level = ig.id left …
answered Apr 23 '13 by 孔夫子
2
votes
Oracle has that feature (pivot columns from subquery) but not SQL Server. The best you can do is dynamic SQL to generate the PIVOT statement, e.g. SQL Server dynamic PIVOT query.
answered Oct 18 '12 by 孔夫子
4
votes
Code that relies on the order of columns is asking for trouble anyway. It should never be a problem, since as a DBA, you're profiling and identifying SELECT * statement, and ostracizing the perpetrato …
answered Oct 2 '12 by 孔夫子
3
votes
3 things I would do. Use #temporary tables instead of @table variables. Both get materialized in tempdb, but using #temporary tables gives you greater flexibility and better information to the Query …
answered Nov 2 '12 by 孔夫子
5
votes
If you add another column for the ancestor, e.g. CREATE TABLE [dbo].[tbl_server_group] ( [refid] [int] IDENTITY(1,1) NOT NULL, [refhid] [hierarchyid] NOT NULL, [reflvl] AS refhi …
answered Dec 5 '12 by 孔夫子
3
votes
4answers
I did my 5 minute research and have not come up with a concise list, or even a list really except for Trace Flags (2012) which is a bit lacking. Looking at this query which uses 8691, I was wondering …
asked Oct 26 '12 by 孔夫子
5
votes
Your query has significant problems. The only reason the answer is still correct is the use of DISTINCT. Otherwise you'd see a gigantic result set being generated if the tables were large due to the c …
answered Oct 16 '12 by 孔夫子
6
votes
You cannot loop through objects in the way you have coded. Here's the working code: Add-Type -AssemblyName "Microsoft.SqlServer.Smo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc9 …
answered Dec 19 '12 by 孔夫子
1
vote
I partially agree with Aaron's comment - in the most general case for storing 21 unrelated pieces of information, you'd probably use 21 bit columns. As a general solution, it may well be your best so …
answered Apr 1 '13 by 孔夫子
6
votes
This is more of a NET USE question than a SSMS/SQL Server question. NET USE has the syntax: net use [{DeviceName | *}] [\\\\ComputerName\ShareName[\volume]] [{Password | *}]] [/user:[DomainN …
answered Oct 25 '12 by 孔夫子
0
votes
If I understand you correctly, your original Unique (name, json_map_enum, entity_json_map_fk) Is made up of name: name of the attribute json_map_enum: the position of this attribute in the …
answered Oct 24 '12 by 孔夫子

15 30 50 per page