sql-server-2005

What are IN and OUT parameter in SQL Server

本秂侑毒 提交于 2019-12-23 17:56:11
问题 What are IN and OUT parameter in SQL Server? 回答1: IN Parameters - parameters that pass data TO a stored Procedure OUT Parameters - parameters that are used to RETURN data FROM a stored procedure Refer MSDN for more details on procedures with IN and OUT params and how to use them Examples of how IN/OUT are used with TSQL can be found here: SQL Server Stored Procedure Basics 来源: https://stackoverflow.com/questions/4116912/what-are-in-and-out-parameter-in-sql-server

Execution time of ALTER COLUMN

老子叫甜甜 提交于 2019-12-23 17:54:33
问题 Having a table with 60 columns, and 200 rows. Altering a BIT column from NULL to NOT NULL , now has a running execution time of over 3 hours. Why is this taking so long? This is the query that I'm execution: ALTER TABLE tbl ALTER COLUMN col BIT NOT NULL Is there a faster way to do it, besides creating a new column, updating it with values from the old column, then dropping the old column and renaming the new one? This is on MS SQL Server 2005. 回答1: IS the ALTER blocked by metadata shared

Month increment query

依然范特西╮ 提交于 2019-12-23 17:50:29
问题 I want to update month in my database by adding 1 month but I don't know how I want to add month in my following stored procedure query I am not good in sql kindly check it ALTER PROCEDURE [dbo].[ChangePassword] @password varchar(20), @epassword varchar(50), @username char(32) AS UPDATE AccountRole SET Password = @password, EPassword = @epassword WHERE UserName = @username UPDATE AccountRole SET ExpiryDate="?" Hhere what do I have to write to increment 1 month when query executes 回答1: To

doesn't quotename work inside of exec?

点点圈 提交于 2019-12-23 17:49:55
问题 I'm trying to do something similar to this question. The answer recommends using quotename inside of an exec. Similar to this: declare @var nvarchar(128) set @var = 'hello world' exec('print ''' + quotename(@var) + '''') But this doesn't work (Incorrect syntax near 'quotename'). Is the answer wrong? I know I can generate the string first, put it in a variable then use it with exec sp_executeSql , but I would rather do it the way in the question if it can work... 回答1: Best solution I could

SQL Server: What are ODBC canonical functions?

落花浮王杯 提交于 2019-12-23 17:25:35
问题 What are ODBC canonical functions (like {fn NOW()} )? 回答1: Basically these canonical functions are a set of functions that Microsoft promise will work on all the types of data source that their providers support. This means that you don't have to differentiate your code depending on which data provider you are actually using. These functions are not a part of basic SQL and therefore you should try to find alternatives that will work standard implementations of SQL or T-SQL. 回答2: From MSDN:

Is it possible to set foreign key between two excel sheets?

╄→尐↘猪︶ㄣ 提交于 2019-12-23 16:57:00
问题 Is it possible to set foreign key between two excel sheets and query records from the two sheets? I got an excel sheet of Student Details and another sheet consists of the total marks. Fields common to both the sheet is the RegID. I need to display the Name and Marks from the two sheets on a grid...How can it be done? please help.... Query = "SELECT Status from [Viewer$] as a LEFT JOIN [UI$] as b ON a.[Responsible Person] = b.[Responsible Person] where b.[Responsible Person] = null" ; This

How to list all columns of a given sql query

让人想犯罪 __ 提交于 2019-12-23 16:52:16
问题 is there an easy way to get a list of all columns of a SQL query? They are listed in the header of the results window of SSMS but I can't copy them. Thanks in advance. EDIT : sorry, I found it myself after a little googling: http://vidmar.net/weblog/archive/2008/06/05/save-sql-query-results-with-column-names-in-msssms.aspx 回答1: Go to Query -> Query Options and check the following box 回答2: If you change to Results To Text, then you can copy them. To save actually executing the full query just

How do you track the time of replicated rows for Subscribers in SQL Server 2005?

落爺英雄遲暮 提交于 2019-12-23 16:35:46
问题 The basic problem is like this: A subscriber has successfully replicated a row from the publisher, using transactional replication. Now, how do we keep track the time of this row being last successfully replicated? A friend has suggested the following solution, which he used for his SQL Server 2000: 1) Add a datetime column. 2) Change the replication stored procedure to update the datetime column (!). The step #2 sets off all sorts of warning bells within me, so I'm asking if there are better

need to use ROW_NUMBER without over in sqlserver 2005 [duplicate]

Deadly 提交于 2019-12-23 16:34:18
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: ROW_NUMBER() without over in SQL I have a grid with sorting on each column and have to show only 50 rows at a time. I am using sql server 2005 as database. Now there is ROW_NUMBER function in sql server 2005 to filter the data with row number but Over(order by [Column]) is mandatory to use. In my case I have to sort my grid with different columns so I can not use the static columns name in order by clause. The

Can SQLExpress 2005 and 2008 be installed on same machine without issue?

天涯浪子 提交于 2019-12-23 16:27:20
问题 I would like to install SQLExpress2005 as an instance "SQLExpress" and install SQLExpresss2008 as "SQLExpress2008" instance. Is there any problem with doing this on the same machine? 回答1: As Long as you give them distinct names, there shouldn't be any problems. The binaries are stored in directories based on version, and you can (and should) point their filegroups at different locations. This should also apply to the Full versions. 回答2: I'm pretty sure you can with the full version of SQL,