sql-server-2008

How to determine if a parameter value was passed to a stored procedure

别说谁变了你拦得住时间么 提交于 2021-01-27 05:24:35
问题 I want to create a stored procedure (in SQL Server 2008 R2) that will update a record in a table based on the table's PK. The stored proc will have, for example, four parameters: @ID int, @Name nvarchar(50), @Email nvarchar(80), @Phone nvarchar(20) How can I determine if the caller of the stored proc passes a NULL value for one (or more) of the parameters vs. if the caller didn't pass anything for one (or more) of the parameters? C# caller example: Caller specifies NULL for @Phone : using

How to determine if a parameter value was passed to a stored procedure

二次信任 提交于 2021-01-27 05:24:29
问题 I want to create a stored procedure (in SQL Server 2008 R2) that will update a record in a table based on the table's PK. The stored proc will have, for example, four parameters: @ID int, @Name nvarchar(50), @Email nvarchar(80), @Phone nvarchar(20) How can I determine if the caller of the stored proc passes a NULL value for one (or more) of the parameters vs. if the caller didn't pass anything for one (or more) of the parameters? C# caller example: Caller specifies NULL for @Phone : using

SQL query for counting records per month

試著忘記壹切 提交于 2021-01-27 04:16:11
问题 I have a dataset I need to build for number of visits per month for particular user. I have a SQL table which contains these fields: User nvarchar(30) DateVisit datetime What I want to achieve now is to get all the visits grouped by month for each user, something like at the picture: I started the query, I am able to get the months and the total sum of visits for that month (not split by user) with this query; select [1] AS January, [2] AS February, [3] AS March, [4] AS April, [5] AS May, [6]

How to get multi table results of an stored procedure using SimpleJDBCCall in spring?

安稳与你 提交于 2021-01-24 13:22:14
问题 I'm implementing a Spring + MSSQL Server 2008 application. I use SimpleJDBCCall API to execute stored procedures and retrieve results. For stored procedures with mono table results, it works fine, but I don't know how to use it for procedures with multi table results. Sample procedure body: multi table results SELECT * FROM TABLE1 SELECT * FROM TABLE2 回答1: I was most ignorant, it does in fact work! You can specify both resultsets, with each its own mapper. In code it looks like this:

How to get multi table results of an stored procedure using SimpleJDBCCall in spring?

≡放荡痞女 提交于 2021-01-24 13:20:53
问题 I'm implementing a Spring + MSSQL Server 2008 application. I use SimpleJDBCCall API to execute stored procedures and retrieve results. For stored procedures with mono table results, it works fine, but I don't know how to use it for procedures with multi table results. Sample procedure body: multi table results SELECT * FROM TABLE1 SELECT * FROM TABLE2 回答1: I was most ignorant, it does in fact work! You can specify both resultsets, with each its own mapper. In code it looks like this:

How to get multi table results of an stored procedure using SimpleJDBCCall in spring?

戏子无情 提交于 2021-01-24 13:19:09
问题 I'm implementing a Spring + MSSQL Server 2008 application. I use SimpleJDBCCall API to execute stored procedures and retrieve results. For stored procedures with mono table results, it works fine, but I don't know how to use it for procedures with multi table results. Sample procedure body: multi table results SELECT * FROM TABLE1 SELECT * FROM TABLE2 回答1: I was most ignorant, it does in fact work! You can specify both resultsets, with each its own mapper. In code it looks like this:

FREETEXT queries in SQL Server 2008 not phrase matching

巧了我就是萌 提交于 2021-01-23 01:55:17
问题 I have a full text indexed table in SQL Server 2008 that I am trying to query for an exact phrase match using FULLTEXT. I don't believe using CONTAINS or LIKE is appropriate for this, because in other cases the query might not be exact (user doesn't surround phrase in double quotes) and in general I want to flexibility of FREETEXT. According to the documentation[MSDN] for FREETEXT: If freetext_string is enclosed in double quotation marks, a phrase match is instead performed; stemming and

FREETEXT queries in SQL Server 2008 not phrase matching

拜拜、爱过 提交于 2021-01-23 01:55:11
问题 I have a full text indexed table in SQL Server 2008 that I am trying to query for an exact phrase match using FULLTEXT. I don't believe using CONTAINS or LIKE is appropriate for this, because in other cases the query might not be exact (user doesn't surround phrase in double quotes) and in general I want to flexibility of FREETEXT. According to the documentation[MSDN] for FREETEXT: If freetext_string is enclosed in double quotation marks, a phrase match is instead performed; stemming and

FREETEXT queries in SQL Server 2008 not phrase matching

白昼怎懂夜的黑 提交于 2021-01-23 01:53:31
问题 I have a full text indexed table in SQL Server 2008 that I am trying to query for an exact phrase match using FULLTEXT. I don't believe using CONTAINS or LIKE is appropriate for this, because in other cases the query might not be exact (user doesn't surround phrase in double quotes) and in general I want to flexibility of FREETEXT. According to the documentation[MSDN] for FREETEXT: If freetext_string is enclosed in double quotation marks, a phrase match is instead performed; stemming and

Access denied for enabled xp_cmdshell for the admin user

谁说胖子不能爱 提交于 2021-01-22 13:17:22
问题 I'm using xp_cmdshell within a database trigger to launch a exe file. xp_cmdshell is enabled(it can execute simple cmd command like 'echo'). But when I try to launch the exe through xp_cmdshell, the access is denied. I am the database administrator. And I can launch the exe through cmd directly. Anyone know why I get denied and how to fix it? 回答1: Likely insufficient NTFS permissions. Make sure the 'user account' that the SQL Server is running as, has permission (Read+Execute) to the *.EXE