sql-server-2005

SSRS - Keep a table the same width when hiding columns dynamically?

元气小坏坏 提交于 2019-12-18 04:12:52
问题 Greetings. I have a SSRS 2005 report that shows prices of things. For some customers, I hide a column from the table (with an expression on the Visibility - hidden property). When I do this, my table shrinks. I've searched long and hard for a way to dynamically resize this table (or to do something at design time to make it stay the same width), but I'm stuck. Answers that simply state 'You can't do this' won't help me. I've read that already: http://forums.asp.net/t/1354956.aspx I'm hoping

MS SQL Server: Check to see if a user can execute a stored procedure

元气小坏坏 提交于 2019-12-18 04:10:39
问题 How can you check to see if a user can execute a stored procedure in MS SQL server? I can see if the user has explicit execute permissions by connecting to the master database and executing: databasename..sp_helpprotect 'storedProcedureName', 'username' however if the user is a member of a role that has execute permissions sp_helprotect won't help me. Ideally I'd like to be able to call something like databasename..sp_canexecute 'storedProcedureName', 'username' which would return a bool. 回答1

MS SQL Server: Check to see if a user can execute a stored procedure

南笙酒味 提交于 2019-12-18 04:10:02
问题 How can you check to see if a user can execute a stored procedure in MS SQL server? I can see if the user has explicit execute permissions by connecting to the master database and executing: databasename..sp_helpprotect 'storedProcedureName', 'username' however if the user is a member of a role that has execute permissions sp_helprotect won't help me. Ideally I'd like to be able to call something like databasename..sp_canexecute 'storedProcedureName', 'username' which would return a bool. 回答1

What is the scope of SET IDENTITY_INSERT xyz ON?

烂漫一生 提交于 2019-12-18 03:58:04
问题 What is the scope of SET IDENTITY_INSERT xyz ON ? If I use this in one stored procedure for a certain table, what happens if a different user running a different procedure, inserts into that certain table at the same time? Also, what happens if different users/procedures try to set SET IDENTITY_INSERT xyz ON for different tables at the same time? 回答1: It's a session option a table can only have the option on for any one table at a time but multiple different sessions can have it on for the

What is the scope of SET IDENTITY_INSERT xyz ON?

ぃ、小莉子 提交于 2019-12-18 03:58:04
问题 What is the scope of SET IDENTITY_INSERT xyz ON ? If I use this in one stored procedure for a certain table, what happens if a different user running a different procedure, inserts into that certain table at the same time? Also, what happens if different users/procedures try to set SET IDENTITY_INSERT xyz ON for different tables at the same time? 回答1: It's a session option a table can only have the option on for any one table at a time but multiple different sessions can have it on for the

How to get time part from SQL Server 2005 datetime in 'HH:mm tt' format

最后都变了- 提交于 2019-12-18 03:53:07
问题 How to get time part from SQL Server 2005 datetime in HH:mm tt format E.g. 11:25 AM 14:36 PM 回答1: One way is: SELECT LTRIM(RIGHT(CONVERT(VARCHAR(20), GETDATE(), 100), 7)) If you have a look at Books Online here, format 100 is the one that has the time element in the format you want it in, it's just a case of stripping off the date from the front. 回答2: You'll need two converts, one to get the HH:mm time, and one to get AM/PM. For example: declare @date datetime set @date = '20:01' SELECT

SQL Insert trigger to update INSERTED table values

坚强是说给别人听的谎言 提交于 2019-12-18 03:49:39
问题 I want to create an Insert trigger that updates values on all the inserted rows if they're null, the new values should be taken from a different table, according to another column in the inserted table. I tried: UPDATE INSERTED SET TheColumnToBeUpdated = ( SELECT TheValueCol FROM AnotherTable.ValueCol WHERE AnotherTable.ValudCol1 = INSERTED.ValueCol1 ) WHERE ValueCol IS NULL But I get this error: Msg 286, Level 16, State 1, Procedure ThisTable_INSERT, Line 15 The logical tables INSERTED and

FIFO based stock inventory valuation in SQL Server [closed]

こ雲淡風輕ζ 提交于 2019-12-18 03:49:26
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have a stock transaction table like this: Item Date TxnType Qty Price ABC 01-April-2012 IN 200 750.00 ABC 05-April-2012 OUT 100 ABC 10-April-2012 IN 50 700.00 ABC 16-April-2012 IN 75 800.00 ABC 25-April-2012

Way to insert text having ' (apostrophe) into a SQL table

試著忘記壹切 提交于 2019-12-18 03:49:13
问题 While I was trying the following SQL command , I got sql error. INSERT INTO exampleTbl VALUES('he doesn't work for me') where doesn't contain the apostrophe. What is the way to insert text having ' (apostrophe) into a SQL table. 回答1: In SQL, the way to do this is to double the apostrophe: 'he doesn''t work for me' If you are doing this programmatically, you should use an API that accepts parameters and escapes them for you, like prepared statements or similar, rather that escaping and using

How to determine the primary key for a table in SQL Server?

£可爱£侵袭症+ 提交于 2019-12-18 03:44:24
问题 What I'd like to be able to do in SQL Server 2005 somehow is with a table name as input determine all the fields that make up the primary key. sp_columns doesn't seem to have this field. Any ideas as to where to look? 回答1: I use this in a code generator I wrote to get the primary key: SELECT i.name AS IndexName, OBJECT_NAME(ic.OBJECT_ID) AS TableName, COL_NAME(ic.OBJECT_ID,ic.column_id) AS ColumnName, c.is_identity, c.user_type_id, CAST(c.max_length AS int) AS max_length, CAST(c.precision AS