sql-server-2012

Count instances of multiple invoices and pivot on location

戏子无情 提交于 2020-04-30 12:22:00
问题 The embarassing fiddle for the entire question can be found here. Basically I have three tables containing invoice information: CREATE TABLE billing ([bill_id] varchar(5), [bill_reference_id] varchar(8), [bill_date] date, [billing_type] varchar(1)) CREATE TABLE billing_detail ([bill_id] varchar(5), [accpac_category_type] varchar(1), [location_id] varchar(1)) CREATE TABLE locations ([location_id] varchar(1), [location] varchar(50)) ; Invoices can have two billing_types I and C (invoice and

Best strategy to automating 'complex' calculation tasks on SQL Server 2012 from Excel [closed]

我只是一个虾纸丫 提交于 2020-04-17 21:30:39
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 days ago . I have a workbook which has 4 spreadsheets. The first spreadsheet uses parameters and data from the other three to calculate some functions and in the end it gives the net present value of some benefit plan conceded to an employee. Description First spreadsheet - Net Present Value

Best strategy to automating 'complex' calculation tasks on SQL Server 2012 from Excel [closed]

时光总嘲笑我的痴心妄想 提交于 2020-04-17 21:30:05
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 days ago . I have a workbook which has 4 spreadsheets. The first spreadsheet uses parameters and data from the other three to calculate some functions and in the end it gives the net present value of some benefit plan conceded to an employee. Description First spreadsheet - Net Present Value

Sql server - log is full due to ACTIVE_TRANSACTION [duplicate]

血红的双手。 提交于 2020-04-07 17:42:49
问题 This question already has answers here : The transaction log for the database is full (13 answers) Closed 5 years ago . I have a very large database (50+ GB). In order to free space in my hard drive, I tried deleting old records from one of the tables . I ran the command: delete from Table1 where TheDate<'2004-01-01'; However, SQL Server 2012 said: Msg 9002, Level 17, State 4, Line 1 The transaction log for database 'MyDb' is full due to 'ACTIVE_TRANSACTION'. and it did not delete a thing.

Sql server - log is full due to ACTIVE_TRANSACTION [duplicate]

血红的双手。 提交于 2020-04-07 17:41:16
问题 This question already has answers here : The transaction log for the database is full (13 answers) Closed 5 years ago . I have a very large database (50+ GB). In order to free space in my hard drive, I tried deleting old records from one of the tables . I ran the command: delete from Table1 where TheDate<'2004-01-01'; However, SQL Server 2012 said: Msg 9002, Level 17, State 4, Line 1 The transaction log for database 'MyDb' is full due to 'ACTIVE_TRANSACTION'. and it did not delete a thing.

Sql server - log is full due to ACTIVE_TRANSACTION [duplicate]

天涯浪子 提交于 2020-04-07 17:40:34
问题 This question already has answers here : The transaction log for the database is full (13 answers) Closed 5 years ago . I have a very large database (50+ GB). In order to free space in my hard drive, I tried deleting old records from one of the tables . I ran the command: delete from Table1 where TheDate<'2004-01-01'; However, SQL Server 2012 said: Msg 9002, Level 17, State 4, Line 1 The transaction log for database 'MyDb' is full due to 'ACTIVE_TRANSACTION'. and it did not delete a thing.

What is the difference between a primary key and a surrogate key?

邮差的信 提交于 2020-04-07 14:26:39
问题 I googled a lot, but I did not find the exact straight forward answer with an example. Any example for this would be more helpful. 回答1: The primary key is a unique key in your table that you choose that best uniquely identifies a record in the table. All tables should have a primary key, because if you ever need to update or delete a record you need to know how to uniquely identify it. A surrogate key is an artificially generated key. They're useful when your records essentially have no

Text message via SQL Server

陌路散爱 提交于 2020-03-23 06:17:44
问题 We have some to critical jobs in our production system. We receiving email about of job status succeded or failed and also we want to set send text message from SQL Server. I searched but looks not so possible, has anybody tried before ? 回答1: I have done this a long time ago using a third-party tool that offers exactly what you need. You can find out more about it here. And here you can find detailed information on how to send and receive messages from SQL Server , using this tool. In the

Use Full Text Search for Persian Language

非 Y 不嫁゛ 提交于 2020-03-18 15:22:27
问题 I see supported language in full text search (SQL Server 2012). Persian (Farsi) does not exist in list. But as I know, there is a way to use full text search for Persian language with adding custom dictionary, using Arabic language and etc. Please help and give me some references and guidance for using Persian language in Full Text Search of SQL Server 2012. 回答1: Yes FTS doesn't support Persian language, but that doesn't mean it won't work with it. Only inflectional queries such as WHERE

Foreign Key Constraint in child table allows to insert values that doesn't exists in the parent table

房东的猫 提交于 2020-03-15 05:49:17
问题 I am using SQL Server 2012. I have defined a foreign key constraint on a table. The foreign key references composite primary key. The fk constraint does not work when one column has '00000' and other column is null. The parent table does not contain '00000'. Both of the fk columns have varchar data type. Below is the example: INSERT INTO XYZ ([BUSINESS_PARTNER_ID] ,[INDUSTRY_TYPE_CDE] ,[INDUSTRY_SUBTYPE_CDE]) VALUES (1, Null '00000') GO The industry type and industry sub type column is