sql-server-2005

Should I dynamically recreate a PDF, rather than store it in either the database or the filesystem?

谁说胖子不能爱 提交于 2019-12-21 05:04:22
问题 I need customers to be able to download PDFs of letters that have been sent to them. I have read the threads about database versus filesystem storage of documents or images, and it does sound like the consensus is that, for anything more than just a few images, filesystem is the way to go. What I want to know: would a reasonable alternative be to just store the letter details in the database, and recreate the PDF 'on the fly' when it is requested? Is that approach superior or inferior to

T SQL - Eloquent replacement of Correlated Subquery

梦想与她 提交于 2019-12-21 05:03:33
问题 I have a query that is currently using a correlated subquery to return the results, but I am thinking the problem could be solved more eloquently perhaps using ROW_NUMBER(). The problem is around the profile of a value v, through a number of years for an Item. Each item has a number of versions, each with its own profile whick starts when the version is introduced and the data currently looks like this: ItemId ItemVersionId Year Value =========================================== 1 1 01 0.1 1 1

Execute stored procedure from cmd.exe?

北慕城南 提交于 2019-12-21 05:01:05
问题 Is there anyway to run a stored proc from cmd.exe ? p.s. I know how to create exec file c# and to run it. I'm asking without any code : Just me and cmd.exe. edit me and cmd.exe : meaning I don't want to write any code. Internal SQL Server help exe files of sql is fine ! sorry for not clarifying this ! 回答1: Try using the SQLCMD Utility : An example: sqlcmd -E -S server_name -d database_name -Q "EXEC schema.storedprocedure parameter01, parameter02" If you'd like to explore other options I'd

MSSQL Server Management Studio (SSMS) 2005 New Query Template

余生颓废 提交于 2019-12-21 04:58:15
问题 How do I change a default "New Query" template in SSMS 2005? 回答1: Posted this question as a reference, I did some googling, and found a simple way of doing it. All you need to do is to edit SQLFile.sql located here: <%= your SQL install dir %>\90\Tools\Binn\VSShell\Common7\IDE\SqlWorkbenchProjectItems\SQL\SQLFile.sql Also, Ctrl+Alt+T will show you all the other templates in SSMS; and check out Free SQL Server tools while you're at it. 来源: https://stackoverflow.com/questions/593047/mssql

Detecting if SQL Server Compact Edition 3.5 SP2 x64 is installed?

与世无争的帅哥 提交于 2019-12-21 04:58:10
问题 I am building an installer and I want to bootstrap SQL Server Compact Edition 3.5 SP2. The problem is that I am looking for the registry key HKLM\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5\ENU\DesktopRuntimeVersion . The reason that is a problem is that for 64-bit machines SQL CE requires that both the 32-bit and 64-bit installers are run. You can't install the 64-bit version until the 32-bit version is installed. As soon as the 32-bit version is installed the registry key

SQL Server Agent Job Running Slow

廉价感情. 提交于 2019-12-21 04:42:31
问题 I am executing a stored procedure using SQL Server Agent Job in SQL Server 2005. This job was running fast until yesterday. Since yesterday this job is taking more than 1 hour instead of 2 mins. I executed the stored procedure in SSMS, it just took less than 1 minute to execute. I could not figure out why it is taking more than 1 hour when executed as a SQL Server Agent job? 回答1: After some time commenting and assuming that the SP performs with the same input parameters and data well when

when insert length of lob data to be replicated exceeds configured maximum 65536

不想你离开。 提交于 2019-12-21 04:40:15
问题 I am trying to insert a value into a column of datatype image in SQL Server. I am getting the following error: Length of LOB data (70823) to be replicated exceeds configured maximum 65536. The statement has been terminated. The data length is less than 2 MB. What is the problem? 回答1: For SQL Server 2005 or earlier you can run: sp_configure 'max text repl size', 2147483647 For SQL Server 2008 or later you can run: sp_configure 'max text repl size', -1 The former increases the maximum size

Bad performance of SQL query due to ORDER BY clause

心已入冬 提交于 2019-12-21 04:31:27
问题 I have a query joining 4 tables with a lot of conditions in the WHERE clause. The query also includes ORDER BY clause on a numeric column. It takes 6 seconds to return which is too long and I need to speed it up. Surprisingly I found that if I remove the ORDER BY clause it takes 2 seconds. Why the order by makes so massive difference and how to optimize it? I am using SQL server 2005. Many thanks. I cannot confirm that the ORDER BY makes big difference since I am clearing the execution plan

Quickest way to identify most used Stored Procedure variation in SQL Server 2005

主宰稳场 提交于 2019-12-21 04:22:30
问题 I am trying to figure out if there's a way to identify a "version" of a SP that gets called the most. I have an SP that gets called with a bunch of different parameters. I know that the SP is causing some issues and trying to pin point the problem. Besides capturing calls to the SP and manually sifting through the results, is it possible to use the profiler to group SP calls by supplied parameters? I'm not a DB(A/E), just a web dev, so any hints/points in the right direction will be helpful.

How to find what Stored Procedures are using what indexes?

£可爱£侵袭症+ 提交于 2019-12-21 04:14:24
问题 I am trying to determine what indexes are no longer used in my Database. I have had great luck using the following query: SELECT OBJECT_NAME(S.[OBJECT_ID]) AS [OBJECT NAME], I.[NAME] AS [INDEX NAME], i.Type_Desc as [Index Type], USER_SEEKS, USER_SCANS, USER_LOOKUPS, USER_UPDATES FROM SYS.DM_DB_INDEX_USAGE_STATS AS S INNER JOIN SYS.INDEXES AS I ON I.[OBJECT_ID] = S.[OBJECT_ID] AND I.INDEX_ID = S.INDEX_ID WHERE i.name is not null AND ( OBJECT_NAME(S.[OBJECT_ID]) = 'Table1' OR OBJECT_NAME(S.