sql-server-2005

Sql server Integration Services 2008-2005 compatibility

我的未来我决定 提交于 2019-12-30 08:12:05
问题 I recently developed an SSIS package on my dev machine using the 2008 version. Later I foud the customer had Sql server 2005 and doesn't plan to upgrade anytime soon. Is there a way to turn the 2008 package into a SSIS 2005 package, like a downgrade wizard? 回答1: Courtesy of an unnamed source we have an app to downgrade a SSIS package from the 2008 version to 2005. Whilst it works with the common components any new components aren’t supported with the exception of the Lookup. 3rd party

SQL Server 2005 DateTime (return only hh:mm)

江枫思渺然 提交于 2019-12-30 06:51:08
问题 I am working on a stored procedure which returns a column of DateTime datatype. But I want to return only hh:mm with no seconds. I am using this but it returns seconds. CONVERT(VARCHAR(8), tbltime.Time, 108) AS [Time] Any ideas to remove the seconds? 回答1: Just change it to convert to VARCHAR(5) instead :) CONVERT(VARCHAR(5),tbltime.Time,108) AS [Time] 回答2: try this: select left(CONVERT(VARCHAR(8),getdate(),108),5) 来源: https://stackoverflow.com/questions/9482358/sql-server-2005-datetime-return

How can I view all grants for an SQL Database?

百般思念 提交于 2019-12-30 05:47:24
问题 I am using SQL Server 2005, I want to find out what all the grants are on a specific database for all tables. It would also help to find out all tables where the delete grant has been given for a specific user. Note: this may be similar to this question, but I could not get the selected answer's solution working (if someone could provide a better example of how to use that, it would help as well) 回答1: The given solution does not cover where the permission is granted against the schema or the

How to Call a stored procedure from another stored procedure?

偶尔善良 提交于 2019-12-30 04:25:05
问题 I have an insert stored procedure which takes many parameters - 2 of them are @FirstName, @LastName. I also have an update stored procedure which takes many parameters - 2 of them are @FirstName, @LastName. What I want to do is, from inside the insert SP, when it's done, call the update SP and send to it the @FirstName, @LastName. I don't know the right syntax to do that; I tried: exec LandData_Update @FirstName, @LastName But I think it's wrong. Can someone tell me how to write this calling?

Why does a database query only go slow in the application?

柔情痞子 提交于 2019-12-30 03:33:12
问题 I have a webpage that takes 10 minutes to run one query against a database, but the same query returns in less than a second when run from SQL Server Management Studio. The webpage is just firing SQL at the database that is executing a stored procedure, which in turn is performing a pretty simple select over four tables. Again the code is basic ADO, setting the CommandText on an SqlCommand and then performing an ExecuteReader to get the data. The webpage normally works quickly, but when it

What is the SQL Server CLR Integration Life Cycle?

孤人 提交于 2019-12-30 03:25:08
问题 How are CLR (.NET) objects managed in SQL Server? The entry point to any CLR code from SQL Server is a static method. Typically you'll only create objects that exist within the scope of that method. However, you could conceivably store references to objects in static members, letting them escape the method call scope. If SQL Server retains these objects in memory across multiple stored procedure/function calls, then they could be useful for caching applications -- although they'd be more

Field value must be unique unless it is NULL

梦想与她 提交于 2019-12-30 03:10:07
问题 I'm using SQL Server 2005. I have a field that must either contain a unique value or a NULL value. I think I should be enforcing this with either a CHECK CONSTRAINT or a TRIGGER for INSERT, UPDATE . Is there an advantage to using a constraint here over a trigger (or vice-versa)? What might such a constraint/trigger look like? Or is there another, more appropriate option that I haven't considered? 回答1: Here is an alternative way to do it with a constraint. In order to enforce this constraint

Create View using Linked Server db in SQL Server

谁说胖子不能爱 提交于 2019-12-30 02:56:08
问题 How can I create View on Linked Server db. For Example I have a linked server [1.2.3.4] on [5.6.7.8]. Both db servers are SQL Sserver 2005. I want to create View on [5.6.7.8] using table on linked server. EDIT: On creating using full name, [1.2.3.4].db.dbo.table, I am getting this error. SQL Execution Error. Executed SQL statement: SELECT * FROM 1.2.3.4.db.dbo.table (YOu can see brackets are not there.) Error Source: .Net SqlClient Data Provider Error Message: Incorrect syntax near '0.0'. ---

How to detect and remove a column that contains only null values?

时光总嘲笑我的痴心妄想 提交于 2019-12-30 02:26:04
问题 In my table table1 there are 6 columns Locations,a,b,c,d,e. Locations [a] [b] [c] [d] [e] [1] 10.00 Null Null 20.00 Null [2] Null 30.00 Null Null Null i need the result like Locations [a] [b] [d] [1] 10.00 Null 20.00 [2] Null 30.00 Null My question is how to detect and delete column that contains all null values using sql query. Is it possible? If yes then please help and give sample. 回答1: How to detect whether a given column has only the NULL value: SELECT 1 -- no GROUP BY therefore use a

How to delete all duplicate records from SQL Table?

我怕爱的太早我们不能终老 提交于 2019-12-30 02:25:10
问题 Hello I have table name FriendsData that contains duplicate records as shown below fID UserID FriendsID IsSpecial CreatedBy ----------------------------------------------------------------- 1 10 11 FALSE 1 2 11 5 FALSE 1 3 10 11 FALSE 1 4 5 25 FALSE 1 5 10 11 FALSE 1 6 12 11 FALSE 1 7 11 5 FALSE 1 8 10 11 FALSE 1 9 12 11 FALSE 1 I want to remove duplicate combinations rows using MS SQL? Remove latest duplicate records from MS SQL FriendsData table. here I attached image which highlights