sql-server-2008-r2

Getting the result columns of table valued functions in SQL Server 2008 R2

倾然丶 夕夏残阳落幕 提交于 2019-12-21 04:12:30
问题 For a constants generator I like to get the meta data of result columns for all my table valued functions (what are the names of the columns returned by each table valued function). How can I get them? Do I have to parse the function's source code or is there an interface providing this information? Thanks for your help Chris The following query I use to get the TVFs: SELECT udf.name AS Name, SCHEMA_NAME(udf.schema_id) AS [Schema] FROM master.sys.databases AS dtb, sys.all_objects AS udf WHERE

SUBSTRING vs LEFT in SQL SERVER

徘徊边缘 提交于 2019-12-21 03:48:35
问题 I posted a question here, but no one answer so I tried to focus what's making my query slow and a question came into my mind. Which one is faster and more efficient? LEFT or SUBSTRING? 回答1: SQL Server is a database. You dod not ask questions of which string processing function is 'faster'. You ask the questions 'which can use an index?' and 'do I have the required index?'. Is all about data access, because disks are sloooooow, not about shifting CPU registers. So, Which can use an index?

How do I stop SQL Server 2008 R2 trying to install some package when I build my setup project?

一世执手 提交于 2019-12-21 03:37:22
问题 I have a WPF Linq-to-SQL project which I have been developing using MS Visual Studio 2008. I was running SQL Server 2008, and recently upgraded it to version R2. Now, whenever I build my SETUP project (not the app itself), the build process causes a window to launch: SQL Server 2008 R2 Management Studio Please wait while Windows configures SQL Server 2008 R2 Management Studio Which after a progress bar and some delay, complains: "The feature you are trying to use is on a network resource that

How to refresh the data on other user's interface when some user edits the data

喜你入骨 提交于 2019-12-21 02:50:50
问题 In a VB.net application I have a SQL interface, I have a users table in the SQL database for users of this application, all of them see the same data now when a user clicks a button changes are saved in the sql and data is refreshed for that user, however I want the data to be refreshed for all users as soon as some user clicks that button. Ideas I have refreshing data every second, which is not good SQL trigger to vb.net which I need more clarification about! What would be the most effective

SQL Server GROUP BY COUNT Consecutive Rows Only

风流意气都作罢 提交于 2019-12-20 13:53:27
问题 I have a table called DATA on Microsoft SQL Server 2008 R2 with three non-nullable integer fields: ID, Sequence, and Value. Sequence values with the same ID will be consecutive, but can start with any value. I need a query that will return a count of consecutive rows with the same ID and Value. For example, let's say I have the following data: ID Sequence Value -- -------- ----- 1 1 1 5 1 100 5 2 200 5 3 200 5 4 100 10 10 10 I want the following result: ID Start Value Count -- ----- ----- ---

Does SQL Server CACHES Query Results? [duplicate]

牧云@^-^@ 提交于 2019-12-20 11:34:39
问题 This question already has answers here : SQL Server cache question (5 answers) Closed 6 years ago . When I run a query does the SQL Server caches the results? Because : When I run the below query: SELECT id FROM Foo WHERE Foo.Name LIKE '%bar%' The query runs for 40 seconds on the 1st time . But on the second run it takes only a few seconds . Is this because the execution plan is somehow cached or actually the data is cached so that I can retrieve it much faster on the 2nd run? 回答1: SQL Server

How Database stores data internally in B-Tree/B+Tree

♀尐吖头ヾ 提交于 2019-12-20 10:48:17
问题 My question is that How database stores data and how it performs query internally. Suppose we have following fields in our table: ID Name Age Weight Manager and we query select * from Table1 where age>50 and weight<100 I am just curious that how it perform query internally. What will the Node of B-Tre/B+Tree contains in this example? 回答1: The example you have chosen is one of the few cases where a single Tree can't do the job (two independent ranges). However, the first chapter of my work-in

SQL Server creating table with clustered index without a primary key

▼魔方 西西 提交于 2019-12-20 10:27:07
问题 Is it possible to create a clustered index from a create table statement in SQL Server 2008 that is not a primary key? The purpose of this is for a table in SQL Azure, so it is not an option for me to first create the table, and then create the clustered index on the table. Edit: Apparently it was FluentMigrator that was causing my problems, it's version table does not have a clustered index so it was erroring trying to create the versioning table not my table. 回答1: Yes, it is possible to

.Skip().Take() on Entity Framework Navigation Properties is executing SELECT * on my SQL Server

家住魔仙堡 提交于 2019-12-20 09:45:01
问题 I have a method on my generated partial class like this: var pChildren = this.Children .Skip(skipRelated) .Take(takeRelated) .ToList(); When I look at my SQL Server, I can see the generated code is doing a SELECT *.* FROM Children This code is taken directly from my class, I have verified that the order of my Skip/Take is BEFORE my .ToList. If I remove the .ToList, that line is fast (and no SQL is sent to my DB), but the moment I try to foreach over the results, I get the same SQL sent to my

System.Data.SqlClient.SqlException when I try to connect to SQL Server 2008R2 with a Windows Universal PlatformApp

≡放荡痞女 提交于 2019-12-20 07:45:26
问题 Hi when I try to connect to a Microsoft SQL Server 2008R2 using System.Data.SqlClient from a Windows Universal Platform App I get following exception: System.Data.SqlClient.SqlException: 'A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The operation completed successfully)' This is my connection string, I'm using SQL Authentification: string connectionString = "{Data Source=xxx.xxx.xxx.xxx;