sql-server-2008-r2

Choosing SQL Server data types for maximum speed

对着背影说爱祢 提交于 2019-12-12 11:54:10
问题 I'm designing a database that will need to be optimized for maximum speed. All the database data is generated once from something I call an input database (which holds the data I'm editing, mainly some polylines, markers, etc for google maps). So the database is not subject to editing, but it needs to hold as many data as it can for quickly displaying results to the user (routes across town, custom polylines, etc). The question is: choosing smaller data types for example like smallint over

could not load file or assembly 'microsoft.sqlserver.management.sdk.sfc version=11.0.0.0

时光怂恿深爱的人放手 提交于 2019-12-12 11:26:52
问题 I am using Database first approach of Entity framework. When I create new connection in "ADO.NET Entity Data Model" then after adding server name and database name, then it shows me this error - Could not load file or assembly 'Microsoft.SqlServer.Management.Sdkc.Sfc, Version=11.0.0.0, Culture=neutral, PublicKey Toekn = 89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. Found many links on Google and tried but it doesn't solve my issue. Could not load

Filtering by RANK() in HAVING clause without subqueries

我怕爱的太早我们不能终老 提交于 2019-12-12 11:04:53
问题 I'm fetching group-wise maximums (the data CTE emulates a set of joins from actual tables): with data as ( select 'Austria' as country, 1 as id, 'red' as colour, 120 as quantity union all select 'Austria', 2, 'green', 96 union all select 'Austria', 3, 'blue', 103 union all select 'Belgium', 1, 'red', 33 union all select 'Belgium', 2, 'green', 12 union all select 'Belgium', 3, 'blue', 40 ) select country, colour, quantity from ( select country, colour, quantity, rank() over (partition by

How can I populate my database's all tables with random data?

馋奶兔 提交于 2019-12-12 10:55:16
问题 Is there such a software out there? It doesn't matter if the data itself make sense. I am just worried about the fields to get populated. Basically, it will read the table definitions and generate some data accordingly. It would also be great if it asks for how many rows to insert per table, whether the default values will be left blank or get populated, how to treat the varchars(to the full extent or up to a given,specified number of characters). Ideally free :) but commercial product

Dump list of full paths of parent/child type records in SQL Server 2008 R2

天涯浪子 提交于 2019-12-12 10:09:56
问题 I need to retrieve the list of full paths of groups (folders) stored in the database as such: select * from groups; group_id parent_group_id name -------- --------------- ------------------------------- 1 NULL Root 2 1 Folder1 3 2 Folder2 4 3 Folder3 There is no limit to the possible depth of groups (could be nested almost indefinitely), so I don't know in advance how many levels I could have. I would like to be able to get the following results from a query and load that into a table that I

SUBQUERY total performance vs case sum performance

时光怂恿深爱的人放手 提交于 2019-12-12 09:50:34
问题 I have to do sum of some columns basis on where clause for better understanding i am implementing a temporary table here declare @tbl table(a int ,b int,c int) insert into @tbl values(1,2,3) insert into @tbl values(2,2,3) insert into @tbl values(1,3,1) insert into @tbl values(1,2,3) insert into @tbl values(1,2,3) and for finding sum of a,b,c ob basis of value of a,b,c ; i am using following query SELECT ( SELECT SUM(a) from @tbl where a=1 )AS a , (SELECT SUM(b) from @tbl where b=2 )AS b ,

SQL Server Management Studio Error : Script failed for UserDefinedFunction

别说谁变了你拦得住时间么 提交于 2019-12-12 09:46:53
问题 I'm working on a local and a remote SQL Server instance with SSMS. I create a tiny function like: create function ufnTestFunc () returns int begin return 1 end When I try to 'modify' it, or choose 'script function as -> alter', I get an error like: Script failed for UserDefinedFunction 'dbo.ufnTestFunc'. (Microsoft.SqlServer.Smo) - Syntax error in TextHeader of UserDefinedFunction 'ufnTestFunc'. (Microsoft.SqlServer.Smo) This also happens on already existing functions. What may be the reason?

Is there any way/tool to identify estimate query run time in SQL sERVER

筅森魡賤 提交于 2019-12-12 09:05:22
问题 I have been google about this for a while..is there any way to identify the estimated query execution time> There are actual execution plan and estimated execution plan on the ssms .The thing is none of these have estimated time. Is it something lacking in the Sql Server? 回答1: Currently, no. Microsoft is currently researching ways to do this using a combination of work already completed and an estimated execution plan (See the details of their research on the Microsoft Research site), so we

Select users belonging only to particular departments

萝らか妹 提交于 2019-12-12 08:18:01
问题 I have the following table with two fields namely a and b as shown below: create table employe ( empID varchar(10), department varchar(10) ); Inserting some records: insert into employe values('A101','Z'),('A101','X'),('A101','Y'),('A102','Z'),('A102','X'), ('A103','Z'),('A103','Y'),('A104','X'),('A104','Y'),('A105','Z'),('A106','X'); select * from employe; empID department ------------------ A101 Z A101 X A101 Y A102 Z A102 X A103 Z A103 Y A104 X A104 Y A105 Z A106 X Note : Now I want to

Create new SQL Server 2008 R2 login from C# program

不打扰是莪最后的温柔 提交于 2019-12-12 07:05:32
问题 I have made a C# front end for a database on SQL Server 2008 R2. Is there a way to create a sql server login from the front end program or do they need to be created in the sql management studio? Thanks 回答1: Yes you can do it with SQL code. Take a look at the CREATE LOGIN documentation. Here is example SQL code: CREATE LOGIN <login_name> WITH PASSWORD = '<password>' MUST_CHANGE 回答2: You can use Smo http://msdn.microsoft.com/en-us/library/ms162169.aspx See this topic for more information http: