sql-server-2008-r2

ResultSet NullPointerException

蹲街弑〆低调 提交于 2019-12-12 03:52:58
问题 I have a stored procedure, I want to call it from JDBC, I got null pointer exception in the line" while (restuls.next()) { My code is: Connection con = Database.getConnection(); CallableStatement callableStatement = null; try { String storedProcedure = "{call getAllCustomerAddresses(?,?,?,?,?,?,?)}"; callableStatement = con.prepareCall(storedProcedure); callableStatement.setInt(1, this.getID()); callableStatement.registerOutParameter(2, java.sql.Types.INTEGER); callableStatement

How to resolve Error 26 in SQL Server?

孤人 提交于 2019-12-12 03:47:41
问题 We're accessing our database with our server (another computer). Before, I'm able to connect with it but it suddenly stop and now I cant connect and I encounter this error which is error 26 Locating Server. Others can connect with our server. I don't know what I've done or what I've change with my machine that causes me to not connect with our server. Can anyone suggest what should I do? I'm using SQL Server 2008 R2. By the way, I can access our server using Remote Desktop Connection but when

How to compare same DB for their Schema and Tables?

本秂侑毒 提交于 2019-12-12 03:45:01
问题 I am using SQL SERVER 2008 R2, I have two same DB, ABC (with only structure like schemas, tables but no data in the table) ABC1 (with schemas, tables and data in the tables) How can I compare #1 & #2 for their Schema and Tables, do we have any software for it or we can do it in the SSMS itself. 回答1: You can write a sproc which will do this for you. 1.Lets get all the tables from ABC into a table variable or temp table. 2.Loop through the temp or table variable and get each table at a time. 3

SqlCacheDependency via Service Broker Notifications - SELECT sensitive ONLY on particular columns

≯℡__Kan透↙ 提交于 2019-12-12 03:43:50
问题 Is it possible to define a Notification on SELECT, but in that way: the Broker would reset Cache only if columns written in select has changed. So Column Sensitive approach. I don't want the cache resets if some unimportant column in the table are changed. I will have a SELECT with INNER JOIN. Thanks in advance for help. 回答1: The theory goes that if you restrict your SELECT columns to contain only the columns of interest, you should be notified only if those columns changed. However the

Find total time worked with multiple jobs / orders with overlap / overlapping times on each worker and job / order

删除回忆录丶 提交于 2019-12-12 03:43:47
问题 I searched night and day back when I was first starting out in the sql world for an answer to this question. Could not find anything similar to this for my needs so I decided to ask and answer my own question in case others need help like I did. Here is an example of the data I have. For simplicity, it is all from the Job table. Each JobID has it's own Start and End time that are basically random and can overlap, have gaps, start and end at the same time as other jobs etc. --Available-- JobID

failed to import excel to sql server using ssis package

ε祈祈猫儿з 提交于 2019-12-12 03:43:47
问题 Hi im developping an ssis package that imports excel files (.xlsx) from an ftp server to a local folder then they are imported to a sql server table . I'm using a foreach mapping to the name of files. The import from the ftp server to local work fine, but the import from the local folder to the sql table failed. It seems that I have a problem in excel source. These are the errors: Start SSIS package "Package.dtsx." Information: 0x1 at Script Task, C # My Message: System.Collections.ArrayList

“Cannot load dynamically generated serialization assembly” error in SQLCLR stored procedure

好久不见. 提交于 2019-12-12 03:38:49
问题 I get the following error when I attempt to execute a C# CLR stored procedure from SQL Server 2008 R2: Msg 6522, Level 16, State 1, Procedure PrintShippingDocLabelsToPDF, Line 0 A .NET Framework error occurred during execution of user-defined routine or aggregate "PrintShippingDocLabelsToPDF": System.InvalidOperationException: Cannot load dynamically generated serialization assembly. In some hosting environments assembly load functionality is restricted, consider using pre-generated

How to pass list to stored procedure

血红的双手。 提交于 2019-12-12 03:32:18
问题 I am trying to pass a list to a SQL Server 2008 R2 using user defined table types but get some errors. My code is: public int DAL_SaveIncramentSalary(tbl_Employee_Master obj, List<dtIncrementSalary> tbl) { try { SqlParameter[] objSqlParameter = new SqlParameter[4]; objSqlParameter[0] = new SqlParameter("@Company_ID", obj.Company_ID); objSqlParameter[1] = new SqlParameter("@Employee_ID", obj.Employee_ID); objSqlParameter[2] = new SqlParameter("@Salary_Month", obj.Govt_DA); objSqlParameter[3] =

How to replace a column values when querying with left join command SQL Server 2008 r2

南笙酒味 提交于 2019-12-12 03:30:45
问题 Alright let me explain my question with example We have a table that contains Id Name Number Now example 1 House 4 2 Hospital 3 3 Airport 'null' 4 Station 2 select t1.id, t1.name, t2.name as name2 from your_table t1 left join your_table t2 on t1.number = t2.id Ok when querying as the above, that 'null' value containing column is giving error. So i want to modify above query in a way that it will return name2 as null and won't give error for that rows. So the result I expect should be: 1 House

Set value to a new datetime column in a table with over 5 million rows

瘦欲@ 提交于 2019-12-12 03:27:01
问题 I have a Table named Example that has a over 5M rows. I want to know the most efficient way to create a new DateTime column that does not allow nulls and has a default value of Now. just setting the value would fail due to the amount of rows. The plan I have in mind would involve: 1) creating a new column that allows nulls. ALTER TABLE Example ADD RecordDate datetime GO 2) set the value of the column to GETDATE() 1000 (or more if possible) rows at a time. 3) once all rows have a value, I