sql-server-2005

Convert Single SQLSERVER 2005 Script to a SQL SERVER 2000 script

心不动则不痛 提交于 2019-12-13 00:13:10
问题 Hi guys first of all I have no expirience with DB programing only basic SQL queries. I have an sql script that was devolped for SQL Server 2005 FB and I need to run it in SQL server 2000. I don't have the original 2005 DB. only a script and a SQL 2000DB I found many guides for converting a whole DB but what can I do with a single script? it is a very long script that I cannnot share here because of datasecurity issues. here is the error please assist me. 回答1: The syntax for specifying index

Recursive query to check that all parents are enabled

青春壹個敷衍的年華 提交于 2019-12-13 00:12:45
问题 I have a CMS system which has a sitemap table with a parent-child relationship and a content table. Sometimes I don't want to include content in queries if it's corresponding sitemap entry or any of its parents is disabled. The basic table structure is: tb_Sitemap : id, parent_id, enabled tb_Content : id, sitemap_id So I want to be able to add something to my queries like this: SELECT * FROM tb_Content WHERE {tb_Sitemap.enabled and any or all parents are also enabled} I know I need to use a

SQL 2005 connection using classic ADO from Windows 2008 yields odd performance

折月煮酒 提交于 2019-12-12 23:24:57
问题 UPDATE: Please see the updates below, as I'm adding more information to the bottom as I run into it. I'm working on setting up a new web server running Windows Server 2008, connecting to another Windows 2003 Server with SQL Server 2005. I'm running into some weird results when trying to run queries from the server to the SQL Server 2005 server. Basically, ever other query has a fixed 625 millisecond overhead if results are returned, but no overhead when it's a non-query: I'll let my sample VB

Loop on table (Without using cursor) to concate data

柔情痞子 提交于 2019-12-12 23:06:32
问题 Please see/run the following script. DECLARE @Products Table ( PId int ) INSERT @Products SELECT 100 INSERT @Products SELECT 101 INSERT @Products SELECT 102 DECLARE @Stff Table ( Stid int, StaffName VARCHAR(20) ) INSERT @Stff SELECT 301, 'White' INSERT @Stff SELECT 302, 'Green' DECLARE @Items Table ( ItemId int, PIdFK int, StIdFK int, CreatedDate DateTime, Notes varchar(100), NotesHistory varchar(2000) ) INSERT INTO @Items SELECT 1, 100, 301, GETDATE(), Null, NULL INSERT INTO @Items SELECT 2,

Assign value to SSIS Script Component new Output Column

别说谁变了你拦得住时间么 提交于 2019-12-12 23:04:54
问题 I'm sure this is a simple issue, but I'm trying to combine 2 columns into a new output column, but have not had any luck with it. Each time I get an 'Object reference not set to an instance of an object.' error Here is my code: Imports System Imports System.Data Imports System.Math Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper Imports Microsoft.SqlServer.Dts.Runtime.Wrapper Public Class ScriptMain Inherits UserComponent Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)

Dynamically create temp table based on resultset from SP

人盡茶涼 提交于 2019-12-12 21:38:58
问题 I have a SP that calls another SP and the resultset needs to be filtered to only the columns that I am interested in. DECLARE @myTable TABLE ( Field1 INT, Field2 INT, Field3 INT ) --If someSP returns say 30 params and I need only 3 params, I don't want to declare all 30 in my temp table @myTable INSERT INTO @myTable (Field1, Field2, Field3) EXEC someSP --Need to selectively filter recordset from SP @InputParam1 = 'test' If I cannot do this, I would want to create the temp table DYNAMICALLY

deploy SQL Server Database with a Winforms app

回眸只為那壹抹淺笑 提交于 2019-12-12 21:30:54
问题 I have created a SQL DB-based winforms application, and I want to deploy it on a client machine. The program is a single user desktop application. Opinions in this post suggest it's better to use SQLite or SQL Server Compact Edition in such scenarios. However, I prefer to use stored procedures, which are not supported in those products. My question is about security concerns: If I use an Access database, I can set a password for the database so at least non experienced users cannot view

Need advice in designing tables in SQL-Server

天大地大妈咪最大 提交于 2019-12-12 21:06:59
问题 I have a quote that contains items (store in table QuoteItem): QuoteItemId, QuoteId, ItemId, Quantity etc. Now, I need to be able to create a group of chosen items in the quote and apply a discount on it. Well that's simple, I create two more tables: Group: GroupId, DiscountPercentage GroupQuoteItem: GroupId, QuoteItemId Let's say I have 30 items in a quote. I made a group that contains items 1-20 from the quote and I applied a discount on it. Now I need to have another group that contains

Rows to Columns using Sql Query

江枫思渺然 提交于 2019-12-12 21:03:45
问题 hi i have a table with columns as Cost Rate Repair 12 Repair 223 Wear 1000 Wear 666 Fuel 500 Repair 600 Fuel 450 Wear 400 Now i want this data as Repair Wear Fuel 825 2066 950 Using Sql Query Thanks in advance 回答1: select sum(case when cost = 'Repair' then rate else null end) as Repair , sum(case when cost = 'Wear' then rate else null end) as Wear , sum(case when cost = 'Fuel' then rate else null end) as Fuel from CostRateTable 回答2: The "rotation" you want (making rows into columns) can be

Spellcheck Data in SQL Server

ε祈祈猫儿з 提交于 2019-12-12 19:15:11
问题 We have a large database with hundreds of tables that have lookup text stored in them with spelling errors from when the application was originally written offshore. Is there a way to run a spellcheck on the data in sql server so we can find all of these errors quickly? 回答1: Export your data to Excel. Distribute the sheets to multiple people to break up the work load Have them run spell check to identify the misspelled words. Gather up the bad records and create update statements from the db.