tsql

Added a new table to my database, throwing an invalid column error

我怕爱的太早我们不能终老 提交于 2020-03-25 18:36:13
问题 Tried calling the new column I made in my database via Razor, throwing an error in a different file. I am completely unsure what any of this means. Server Error in '/' Application. Invalid column name 'ProductImage'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Invalid column name

SQL Server XML querying: Query multiple child elements with same name

£可爱£侵袭症+ 提交于 2020-03-23 09:51:43
问题 In a previous question I wanted to know how I can use SQL to JOIN different XML elements based on an identifier. I was provided with several nice solutions as you can see here. Now I am in the process of adapting this solution to my actual data. Unfortunately I stumbled upon a new obstacle that was not present in the minimum viable example I provided in the linked question. In my actual data I also have several child elements of the same name. See the element <subElement> in the following

SQL Server XML querying: Query multiple child elements with same name

纵然是瞬间 提交于 2020-03-23 09:51:13
问题 In a previous question I wanted to know how I can use SQL to JOIN different XML elements based on an identifier. I was provided with several nice solutions as you can see here. Now I am in the process of adapting this solution to my actual data. Unfortunately I stumbled upon a new obstacle that was not present in the minimum viable example I provided in the linked question. In my actual data I also have several child elements of the same name. See the element <subElement> in the following

How to conditionally exit .BAT file from SQL code run through SQLCMD

五迷三道 提交于 2020-03-22 14:28:53
问题 I have a .bat (Windows command) file that includes invocations of SQLCMD and other commands. (Of course SQLCMD is sending my T-SQL code to SQL Server.) I want to detect certain conditions in the SQL code, and conditionally exit the entire batch file. I've tried various combinations of RAISERROR, THROW, and deliberate division by 0 (I'm not proud) along with various command line switches on SQLCMD and handling of errorlevel in the .bat file. I tried the answer to 5789568 but could not get it

How to conditionally exit .BAT file from SQL code run through SQLCMD

徘徊边缘 提交于 2020-03-22 14:19:06
问题 I have a .bat (Windows command) file that includes invocations of SQLCMD and other commands. (Of course SQLCMD is sending my T-SQL code to SQL Server.) I want to detect certain conditions in the SQL code, and conditionally exit the entire batch file. I've tried various combinations of RAISERROR, THROW, and deliberate division by 0 (I'm not proud) along with various command line switches on SQLCMD and handling of errorlevel in the .bat file. I tried the answer to 5789568 but could not get it

How to conditionally exit .BAT file from SQL code run through SQLCMD

放肆的年华 提交于 2020-03-22 14:17:51
问题 I have a .bat (Windows command) file that includes invocations of SQLCMD and other commands. (Of course SQLCMD is sending my T-SQL code to SQL Server.) I want to detect certain conditions in the SQL code, and conditionally exit the entire batch file. I've tried various combinations of RAISERROR, THROW, and deliberate division by 0 (I'm not proud) along with various command line switches on SQLCMD and handling of errorlevel in the .bat file. I tried the answer to 5789568 but could not get it

How to conditionally exit .BAT file from SQL code run through SQLCMD

大城市里の小女人 提交于 2020-03-22 14:17:19
问题 I have a .bat (Windows command) file that includes invocations of SQLCMD and other commands. (Of course SQLCMD is sending my T-SQL code to SQL Server.) I want to detect certain conditions in the SQL code, and conditionally exit the entire batch file. I've tried various combinations of RAISERROR, THROW, and deliberate division by 0 (I'm not proud) along with various command line switches on SQLCMD and handling of errorlevel in the .bat file. I tried the answer to 5789568 but could not get it

How can I write the NULL in database with C#

杀马特。学长 韩版系。学妹 提交于 2020-03-22 09:07:03
问题 I have A table and B table. B table update everyday according to changes from A table. in A table 2 entities like : SCD_DEPT (String Value) and LEAVE_DATE(DateTime) and in A table empty values are looking "NULL" for SCD_DEPT and LEAVE_DATE but in B table empty SCD_DEPT values are looking empty. I want to empty SCD_DEPT values looks "NULL" in B table it's my UPDATE part in my code var employeequery = $"{UpdateQuery} EMAIL=@EMAIL, GID = @GID, SAP_COMPANY_CODE=@SAP_COMPANY_CODE, FIRST_NAME=

How can I write the NULL in database with C#

旧时模样 提交于 2020-03-22 09:06:30
问题 I have A table and B table. B table update everyday according to changes from A table. in A table 2 entities like : SCD_DEPT (String Value) and LEAVE_DATE(DateTime) and in A table empty values are looking "NULL" for SCD_DEPT and LEAVE_DATE but in B table empty SCD_DEPT values are looking empty. I want to empty SCD_DEPT values looks "NULL" in B table it's my UPDATE part in my code var employeequery = $"{UpdateQuery} EMAIL=@EMAIL, GID = @GID, SAP_COMPANY_CODE=@SAP_COMPANY_CODE, FIRST_NAME=

How to update data as json array and select data as json array in sql server

谁说我不能喝 提交于 2020-03-22 09:06:14
问题 I am new in SQL server 2017 for JSON result. I am storing JSON array in one column in my table. I am saving id's array in that table, but i want to update its relative text from other table, so please help me in this. create table #subjectList(subjectID int identity(1,1),subjectName varchar(50)) insert into #subjectList(subjectName) select 'Math' union all select 'English' union all select 'Hindi' union all select 'PC' union all select 'Physics' select * from #subjectList Create table