sql-server-2008

Jet Engine's query-optimization is based on statistics, but how are they refreshed with linked tables?

自古美人都是妖i 提交于 2020-01-06 04:35:06
问题 i am dealing with some legacy access < 2007 "databases". All the tables are linked tables to a SQL Server 2008. While the odbc-links are established the table structure is copied into the mdb-file together with the DSN-string. Thats what one can see in Msysobjects. A query forces the jet-engine to retrieve the data from SQL Server under respect of the jet-engines optimization. Therefore it is essential to refresh the odbc-links whenever a change in sql server is made, like adding a new index

sql query to select records in a specific format (using pivot or other)

橙三吉。 提交于 2020-01-06 04:29:13
问题 I have an SQL table like this: Animal1 Animal2 Corelation ---------+---------------+-------------- Cat Cat 1 Cat Dog 0.6 Cat Mouse 0.8 Dog Cat 0.6 Dog Dog 1 Dog Mouse 0.4 Mouse Cat 0.8 Mouse Dog 0.4 Mouse Mouse 1 I'm looking for an SQL query to return the following results: Animal 1 Cat Dog Mouse ---------+---------------+------------------+---------------+ Cat 1 0.6 0.8 Dog 6 1 0.4 Mouse 0.8 0.4 1 Basically i want more readable version of the table. I tried to use pivot like this: use

Accessing a SQL Server database from Visual Studio

风格不统一 提交于 2020-01-06 04:19:14
问题 I am using Visual Basic 2010 to write a front end to a database I created in SQL Server 2008. The problem I am having is when trying to add the SQL Server database as a new data source, I get the error message: You don't have permission to open this file. Contact the file owner or an administrator to obtain permission So is this a permission I need to set up in SQL Server to allow the connection from VB? If so, can someone please tell me what this is? Really stuck with this, hoping to find an

Create more than one non clustered index on same column in SQL Server

烈酒焚心 提交于 2020-01-06 04:01:07
问题 What is the index creating strategy? Is it possible to create more than one non-clustered index on the same column in SQL Server? How about creating clustered and non-clustered on same column? Very sorry, but indexing is very confusing to me. Is there any way to find out the estimated query execution time in SQL Server? 回答1: The words are rather logical and you'll learn them quite quickly. :) In layman's terms, SEEK implies seeking out precise locations for records, which is what the SQL

Delete xml node from SQL Server 2008 r2 table column based on attribute value

自作多情 提交于 2020-01-06 04:00:26
问题 I have an xml structure as follows <DifficultyRule xmlns="urn:gjensidige:processguide:201201"> <Id>fc39f423-05c0-4de9-ae46-12fe3c0c279b</Id> <Code>5595e558-7d10-4767-86dc-5d16f24b8151_Code</Code> <Author /> <Updated>9/5/2012</Updated> <Sequence>0</Sequence> <FromControls> <Control> <Code>oiuyui</Code> <Id>70579cbe-c0b5-4b49-a7b8-6201af388f59</Id> <FilterValues> <FilterValue xmlns:p5="urn:gjensidige:processguide:201201" p5:Id="b897f3ac-b40f-4b96-b438-eb156a26457e" p5:Code="e" p5:LookupId=

Child sProc cannot reference a Local temp table created in parent sProc

ぃ、小莉子 提交于 2020-01-06 02:04:06
问题 On our production SQL2000 instance, we have a database with hundreds of stored procedures, many of which use a technique of creating a #TEMP table "early" on in the code and then various inner stored procedures get EXECUTEd by this parent sProc. In SQL2000, the inner or "child" sProc have no problem INSERTing into #TEMP or SELECTing data from #TEMP. In short, I assume they can all refer to this #TEMP because they use the same connection. In testing with SQL2008, I find 2 manifestations of

Execute SQL Server stored procedure with input parameter

不羁岁月 提交于 2020-01-06 02:00:26
问题 Could you suggest please how to execute from Sql Server a stored procedure that receives an input parameter? I tried this but it failed: EXEC GetFilmsInCategory('SF'); The stored procedure is correctly defined, by the way. I executed it from the visual interface and it worked, with this code generated automatically: DECLARE @return_value int EXEC @return_value = [dbo].[GetFilmsInCategory] @CatNume = N'SF' SELECT 'Return Value' = @return_value I find this automatically generated code too...

Execute SQL Server stored procedure with input parameter

牧云@^-^@ 提交于 2020-01-06 02:00:07
问题 Could you suggest please how to execute from Sql Server a stored procedure that receives an input parameter? I tried this but it failed: EXEC GetFilmsInCategory('SF'); The stored procedure is correctly defined, by the way. I executed it from the visual interface and it worked, with this code generated automatically: DECLARE @return_value int EXEC @return_value = [dbo].[GetFilmsInCategory] @CatNume = N'SF' SELECT 'Return Value' = @return_value I find this automatically generated code too...

Where should the partitioning column go in the primary key on SQL Server?

瘦欲@ 提交于 2020-01-06 01:46:48
问题 Using SQL Server 2005 and 2008. I've got a potentially very large table (potentially hundreds of millions of rows) consisting of the following columns: CREATE TABLE ( date SMALLDATETIME, id BIGINT, value FLOAT ) which is being partitioned on column date in daily partitions. The question then is should the primary key be on date, id or value, id ? I can imagine that SQL Server is smart enough to know that it's already partitioning on date and therefore, if I'm always querying for whole chunks

MS SQL Backslash preceding new line/line feed removes line break

心已入冬 提交于 2020-01-05 23:15:09
问题 I'm working in classical ASP and am trying to simply insert some user input into my MS SQL 2008 database. This is something I do basically every day, but I don't think I've ever experienced this bug before. The bug I am getting is that, if a user ends a line of text in backslash, and starts a new line below, both the backslash and line break are lost after the data is stored in the DB. If i try the following statement, hardcoded from an ASP file: UPDATE TBLarticle_text SET Introduction =