Database Tables

This page contains information on the database tables in assessingsearch on VSQL01. (NOTE: assessingupdates is a clone of assessingsearch for dev)

Views

This view does not appear to be used by default.asp or any other procedures.

This view could be deleted from the DB.

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create view [dbo].[value_tax]
as 
SELECT TOP 1 dbo.taxbill.*, dbo.Res_exempt.personal_exemption, dbo.Landuse_Described.Description, dbo.propertycodes_described.*,
dbo.Res_exempt.residential_exemption, dbo.parcel.condo_main condo__main, tax_preliminary.[Bill Year], tax_preliminary.[Bill Number],
tax_preliminary.[RE Tax Amt], tax_preliminary.[CPA Amt], tax_preliminary.[Downtown BID Amt], tax_preliminary.[Greenway BID Amt], tax_preliminary.[Total Billed Amt]
FROM dbo.taxbill  
LEFT OUTER JOIN dbo.parcel ON dbo.taxbill.parcel_id = dbo.parcel.parcel_id  
LEFT OUTER JOIN dbo.Res_exempt ON dbo.taxbill.parcel_id = dbo.Res_exempt.parcel_id  
LEFT OUTER JOIN dbo.propertycodes_described ON dbo.taxbill.property_type = dbo.propertycodes_described.[property-code]  
LEFT OUTER JOIN dbo.Landuse_Described ON dbo.taxbill.land_use = dbo.Landuse_Described.Short_Description  
LEFT OUTER JOIN dbo.tax_preliminary ON dbo.taxbill.parcel_id = dbo.tax_preliminary.parcel_id  

GO

Stored Procedures

None of these stored procedures appear to be used by default.asp or any view or triggers.

These procedures could be deleted from the DB

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[parcel_value_history]
	@parcelId nchar(10)
AS
BEGIN
	SET NOCOUNT ON;
	SELECT parcel_history.*, [landuse_described].[description] 
		FROM (SELECT * FROM [value_history] WHERE [value_history].parcel_id = @parcelId) AS parcel_history 
			JOIN [landuse_described] ON parcel_history.land_use=[landuse_described].Short_Description 
	ORDER BY parcel_history.fiscal_year DESC
END
GO

-- =============================================
-- Author:		<Kumat,Rashmi>
-- Create date: <Jul 23,2008,>
-- Description:	<Get Exempt status based on parcel id >
-- =============================================
CREATE PROCEDURE [dbo].[sp_get_exempt_status]
	-- Add the parameters for the stored procedure here
 @parcel_id nchar(10),
 @land_type nchar(2)
	
AS
BEGIN

SET NOCOUNT ON;
declare @personal_exemption nchar(5)

if @land_type = 'r'
	begin
	select residential_exemption from res_exempt where parcel_id = @parcel_id
	end
else
	begin
	select @personal_exemption = clause_abatement_type_1 from taxbillw where parcel_id = @parcel_id
		if @personal_exemption is null or @personal_exemption = ''
			select 'N'
		else
			select 'Y'
		end
END
GO

-- =============================================
-- Author:		<Kumat,Rashmi>
-- Create date: <Jul 30,2008,>
-- Description:	<Get Application_number for overval forms >

-- Check wheteher Parcel Id exists . IF yes , then return full_appnumber
-- If parcel_id does not exist , insert one entry into table , with incremental app number and current year

-- =============================================

CREATE PROCEDURE [dbo].[sp_get_overval_application_number]
	-- Add the parameters for the stored procedure here
 @parcel_id nchar(10)
AS
BEGIN
SET NOCOUNT ON;

declare @count int
-- increment appyear to next calendar year after December 1, to make development easier
select @count = count(id) from overval_app_numbers where parcel_id = @parcel_id and [appyear] = Cast(YEAR(DATEADD(month,1,getdate())) as nchar(10))

--IF @count > 0 and @count = 1
--	begin
--	select full_appnumber from overval_app_numbers where parcel_id = @parcel_id
--	end
--
--else 

if @count < 50 

	begin

	declare @appyear nvarchar(10)
	declare @apprange nvarchar(10) 
	declare @full_appnumber nvarchar(15)

	set @appyear = YEAR(DATEADD(month,1,getdate()))

	select @apprange = max(apprange) from overval_app_numbers where appyear = @appyear
		
		if @apprange is null 
		set @apprange = 60000
		else
		set @apprange = @apprange + 1	

	set @full_appnumber = @appyear + @apprange	
		
	insert into overval_app_numbers (appyear,Parcel_id,apprange, full_appnumber)
	values (@appyear,@parcel_id,@apprange,@full_appnumber)
	
	select full_appnumber from overval_app_numbers where parcel_id = @parcel_id and apprange = @apprange

	end

if @count >= 50 

	begin
	
	select '50'
	
	end


END
GO

-- =============================================
-- Author:		<Kumat,Rashmi>
-- Create date: <Jul 23,2008,>
-- Description:	<Get Residential or Personal Exemption data to prefill the PDF >
-- =============================================
CREATE PROCEDURE [dbo].[sp_get_overval_data]
	-- Add the parameters for the stored procedure here
 @parcel_id nchar(10)
AS
BEGIN

SET NOCOUNT ON;

select isnull(owner,'') , isnull(street_number,''), isnull(street_number_suffix,''),isnull(street_name,'') ,isnull(apt_unit,''),' BOSTON MA ',isnull(location_zip_code,''),isnull(land_use,''),isnull(total_value,'') ,isnull(bill_number,'') 
from taxbillw a
where a.parcel_id = @parcel_id

END
GO

-- =============================================
-- Author:		<Kumat,Rashmi>
-- Create date: <Jul 23,2008,>
-- Description:	<Determine Overvaluation type based on parcel id >
-- =============================================
CREATE PROCEDURE [dbo].[sp_get_overval_type]
	-- Add the parameters for the stored procedure here
 @parcel_id nchar(10)
AS
BEGIN
SET NOCOUNT ON;

declare @land_use varchar(10)
declare @overval_type varchar(10)

select @land_use = land_use from taxbillw where parcel_id = @parcel_id

if @land_use in ('R1','R2','R3','CD')
set @overval_type = 'short'
else
set @overval_type = 'long'

select @overval_type

END
GO

-- =============================================
-- Author:		Satyen
-- Create date: 2020-01
-- Description:	Return parcel data to abatement/exemption .NET application
-- =============================================
CREATE PROCEDURE [dbo].[sp_get_pdf_data]
	-- Add the parameters for the stored procedure here
 @parcel_id nchar(10),
 @form_type nvarchar(25)
	
AS
BEGIN

SET NOCOUNT ON;

DECLARE @application_number int

IF @form_type = 'overval'
BEGIN
 SELECT @application_number = [id] FROM [overval_application_numbers] WHERE [overval_application_numbers].[parcel_id]=@parcel_id and [id] >= (YEAR(DATEADD(month,1,getdate())) * 100000)

 IF @application_number IS NULL
 BEGIN
  SELECT @application_number = 1 + MAX([id]) FROM [overval_application_numbers]
  INSERT INTO [overval_application_numbers] VALUES (@application_number, @parcel_id)
 END
END

IF ISNUMERIC(@parcel_id) = 1
 SELECT [owner]
 ,[street_number]
 ,[street_number_suffix]
 ,[street_name]
 ,[apt_unit]
 ,[location_zip_code]
 ,[land_use]
 ,[total_value] = Format([total_value], 'N0')
 ,[bill_number]
 ,[residential_exemption]
 ,[personal_exemption]
 ,[application_number] = COALESCE(@application_number,0)
 FROM [taxbill], [taxes], [Res_exempt]
 WHERE [taxbill].[parcel_id] = @parcel_id
 AND [taxes].[parcel_id] = @parcel_id
 AND [Res_exempt].[parcel_id] = @parcel_id

END


GO

-- =============================================
-- Author:		<Kumat,Rashmi>
-- Create date: <Jul 23,2008,>
-- Description:	<Get Residential or Personal Exemption data to prefill the PDF >
-- =============================================
CREATE PROCEDURE [dbo].[sp_get_resex_and_persex_data]
	-- Add the parameters for the stored procedure here
 @parcel_id nchar(10)
AS
BEGIN

SET NOCOUNT ON;

select isnull(owner,'') , isnull(street_number,''), isnull(street_number_suffix,''), isnull(street_name,'') ,isnull(apt_unit,''),' BOSTON MA ',isnull(location_zip_code,''),isnull(land_use,'') from taxbillw where parcel_id = @parcel_id

END
GO

-- =============================================
-- Author:		<Kumat,Rashmi>
-- Create date: <Jul 23,2008,>
-- Description:	<Get Exempt status based on parcel id >
-- =============================================
CREATE PROCEDURE [dbo].[sp_get_resex_land_use]
	-- Add the parameters for the stored procedure here
 @parcel_id nchar(10)
 	
AS
BEGIN

SET NOCOUNT ON;

declare @land_use varchar(10)
select @land_use = land_use from taxbillw where parcel_id = @parcel_id

If @land_use in ('R1','R2','R3','R4','CD','A','RC') 
select 'Y'
else
select 'N'

END
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		Satyen
-- Create date: 2017-05-01
-- Description:	update current owners
-- =============================================
CREATE PROCEDURE [dbo].[sp_update_current_owners]
AS
BEGIN

UPDATE [dbo].[parcel_from_vsql]
	SET [owner] = LTRIM(RTRIM(REPLACE(REPLACE(REPLACE([owner],'  ',' '),'  ',' '),'  ',' ')))

UPDATE [current_owners]
	SET [owner_name] = [parcel_from_vsql].[owner]
	FROM [parcel_from_vsql]
	WHERE [current_owners].[Parcel_id] <> [parcel_from_vsql].[parcelid]
	AND [current_owners].[seqno] = 1

-- update all_owners table
DELETE FROM [parcel_all_owners]

INSERT INTO [parcel_all_owners]
	SELECT [parcel_id], [street_number], [street_name], [apartment_no], [suffix], [landuse], [owner], [condo_main]
		FROM [parcel]
	UNION
	SELECT [parcel].[parcel_id], [parcel].[street_number], [parcel].[street_name], [parcel].[apartment_no], [parcel].[suffix], [parcel].[landuse], coalesce([current_owners].[owner_name],''), [parcel].[condo_main]
		FROM [current_owners] JOIN [parcel]
		ON [current_owners].[parcel_id] = [parcel].[parcel_id]

--reindex
DBCC DBREINDEX(current_owners,'',100)
DBCC DBREINDEX(parcel_all_owners,'',100)




END

GO

Database Table Structure

additional_data

This table is accessed from default.asp.

ColumnSourceNotes

parcel_id nvarchar(10)

MS Access

PK The unique parcel ID

living_area int

MS Access

gross_area int

MS Access

year_built smallint

MS Access

year_remodeled smallint

MS Access

condo_units_residential smallint

MS Access

condo_units_commercial smallint

MS Access

condo_units_mixed smallint

MS Access

stories decimal(4, 1)

MS Access

bid

This table is accessed from default.asp.

Potentially, there is some adjustment of the bid amount depending on billing schedule.

ColumnSourceNotes

parcel_id nvarchar(10)

PK The unique parcel ID

bid_greenway money

MS Access

This is extracted and compiled from the greenway_bid table in the MSAccess database.

bid_downtown money

MS Access

This is extracted and compiled from the greenway_bid table in the MSAccess database.

condo_attributes

This table is accessed from default.asp.

ColumnSourceNotes

parcel_id nchar(10)

Style nvarchar(20)

Exterior Condition nvarchar(14)

Exterior Wall nvarchar(14)

Grade nvarchar(14)

Stories nvarchar(4)

'#Units' decimal(9, 0)

Street Type nvarchar(50)

Square Feet of Living area decimal(9, 0)

Base Floor nvarchar(4)

Fireplaces nvarchar(4)

'# Floors' nvarchar(4)

Total Rooms nvarchar(4)

Bedrooms nvarchar(4)

Bathrooms nvarchar(4)

Half Bathrooms nvarchar(4)

Bathroom Style1 nvarchar(14)

Bathroom Style2 nvarchar(14)

Bathroom Style3 nvarchar(14)

Kitchen Style nvarchar(14)

Kitchen Type nvarchar(14)

Heat Type nvarchar(14)

Interior Condition nvarchar(14)

Interior Finish nvarchar(14)

Orientation nvarchar(14)

Corner Unit nvarchar(14)

View nvarchar(14)

condo_main nchar(10)

CNS_BID decimal(9, 0)

current_owners

This table is accessed from default.asp.

ColumnSourceNotes

Parcel_id nchar(10)

PK

seqno tinyint

PK

owner_name nvarchar(255)

landuse_described

This table is accessed from default.asp.

ColumnSourceNotes

id int

Short_Description nvarchar(10)

Description nvarchar(50)

outbuildings

This table is accessed from default.asp.

ColumnSourceNotes

parcel_id nchar(10)

PK

line_number tinyint

PK

Code nvarchar(50)

Tot Units decimal(9, 2)

Quantity decimal(9, 2)

Quality nvarchar(50)

Condition nvarchar(50)

Overval_application_numbers

This table does not appear to be used.

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[overval_application_numbers](
	[id] [int] NOT NULL,
	[parcel_id] [nchar](10) NOT NULL
) ON [PRIMARY]
GO

parcel

This table is accessed from default.asp.

ColumnSourceNotes

parcel_id nchar(10)

PK

street_number nvarchar(10)

street_name nvarchar(50)

apartment_no nvarchar(20)

suffix nvarchar(2)

landuse nvarchar(2)

owner nvarchar(255)

condo_main nchar(10)

parcel_all_owners

This table is accessed from default.asp.

ColumnSourceNotes

parcel_id nchar(10)

street_number nvarchar(10)

street_name nvarchar(50)

apartment_no nvarchar(20)

suffix nvarchar(2)

landuse nvarchar(2)

owner nvarchar(255)

condo_main nchar(10)

propertycodes_described

This table is accessed from default.asp.

ColumnSourceNotes

property-code smallint

property-class tinyint

property-class-description nvarchar(255)

property-code-description nvarchar(255)

property-code-state bit

property-code-city bit

Res_exempt

This table is accessed from default.asp.

ColumnSourceNotes

parcel_id nvarchar(10)

MSAccess:Tyler Real Estate Export File

residential_exemption nvarchar(255)

MSAccess:Tyler Real Estate Export File

personal_exemption bit

MSAccess:Taxes

Defaults to 0 but is 1 if either of Personal Ex Type 1 or Personal Ex Type 2 is not null.

RESIDENTIAL PROPERTY ATTRIBUTES

This table is accessed from default.asp.

ColumnSourceNotes

parcel_id nvarchar(255)

Building Seq float

Composite Land Use nvarchar(255)

Building Style nvarchar(255)

Rooms nvarchar(255)

Bedrooms nvarchar(255)

Full Bath float

Half Bath float

Other Fixtures float

Bath Style 1 nvarchar(255)

Bath Style 2 nvarchar(255)

Bath Style 3 nvarchar(255)

Kitchens float

Kitchen Type nvarchar(255)

Kitchen Style 1 nvarchar(255)

Kitchen Style 2 nvarchar(255)

Kitchen Style 3 nvarchar(255)

Fireplaces float

AC Type nvarchar(255)

Heat Type nvarchar(255)

Interior Condition nvarchar(255)

Interior Finish nvarchar(255)

View nvarchar(255)

Grade nvarchar(255)

"# of Parking Spots" nvarchar(255)

Year Built float

Story Height nvarchar(255)

Roof Cover nvarchar(255)

Roof Structure nvarchar(255)

Exterior Finish nvarchar(255)

Exterior Condition nvarchar(255)

Foundation nvarchar(255)

tax_preliminary

This table is accessed from default.asp.

ColumnSourceNotes

parcel_id nchar(10)

Bill Year smallint

Bill Number int

RE Tax Amt decimal(12, 2)

CPA Amt decimal(12, 2)

Downtown BID Amt decimal(12, 2)

Greenway BID Amt decimal(12, 2)

Total Billed Amt decimal(12, 2)

taxbill

This table is accessed from default.asp.

ColumnSourceNotes

parcel_id nchar(10)

condo_main nchar(10)

ward_precinct_block nvarchar(7)

street_number nvarchar(10)

street_number_suffix nvarchar(10)

street_name nvarchar(50)

street_name_only nvarchar(50)

street_name_suffix nvarchar(2)

apt_unit nvarchar(20)

city nvarchar(50)

location_zip_code nvarchar(5)

location_zip_code_plus_four nvarchar(4)

owner nvarchar(50)

mail_addressee nvarchar(50)

mail_street_address1 nvarchar(50)

mail_street_address2 nvarchar(50)

mail_city_and_state nvarchar(50)

mail_zip_code nvarchar(5)

mail_zip_code_plus_four nvarchar(4)

country nvarchar(50)

future_owner nvarchar(50)

future_mail_addressee nvarchar(50)

future_owner_mail_street_address1 nvarchar(50)

future_owner_mail_street_address2 nvarchar(50)

future_owner_mail_city_and_state nvarchar(50)

future_owner_mail_zip_code nvarchar(5)

future_owner_mail_zip_code_plus_four nvarchar(4)

future_owner_country nvarchar(50)

land_area int

land_use nvarchar(2)

exempt_code nvarchar(4)

property_type nvarchar(4)

state_class_code nvarchar(1)

residential_building_value decimal(12, 2) residential_land_value decimal(12, 2) residential_air_rights_value decimal(12, 2)

commercial_building_value decimal(12, 2) commercial_land_value decimal(12, 2) commercial_air_rights_value decimal(12, 2)

industrial_building_value decimal(12, 2) industrial_land_value decimal(12, 2) industrial_air_rights_value decimal(12, 2)

open_space_land_value decimal(12, 2)

exempt_building_value decimal(12, 2) exempt_land_value decimal(12, 2)

total_building_value decimal(12, 2) total_land_value decimal(12, 2) total_value decimal(12, 2)

latest_sale_date date

latest_bkpgcert nvarchar(10)

residential_exemption_flag bit

coop_value decimal(12, 2)

clause_abatement_type_1 nvarchar(6) clause_abt_1_pct_ownership nvarchar(5) clause_abt_1_pct_occupancy nvarchar(5) clause_abatement_type_2 nvarchar(6) clause_abt_2_pct_ownership nvarchar(5) clause_abt_2_pct_occupancy nvarchar(5)

paraplegic nvarchar(6)

workoff_type nvarchar(6) workoff_credit_amt decimal(12, 2)

sewer_betterment_amt decimal(12, 2) street_betterment_amt decimal(12, 2) sidewalk_betterment_amt decimal(12, 2)

penalty1_type nvarchar(6) penalty1_amt decimal(12, 2) penalty2_type nvarchar(6) penalty2_amt decimal(12, 2) penalty3_type nvarchar(6) penalty3_amt decimal(12, 2)

fine1_type nvarchar(6) fine1_amt decimal(12, 2) fine2_type nvarchar(6) fine2_amt decimal(12, 2) fine3_type nvarchar(6) fine3_amt decimal(12, 2)

BID_type nvarchar(6) BID_amt decimal(12, 2)

nontax_collection_type nvarchar(6) nontax_collection_amt decimal(12, 2)

personal_exemption_flag bit

condo_main_value decimal(12, 2)

taxes

This table is accessed from default.asp.

ColumnSourceNotes

parcel_id nchar(10)

PK

gross_tax decimal(12, 2)

net_tax decimal(12, 2)

persexempt_1 decimal(12, 2)

persexempt_2 decimal(12, 2)

persexempt_total decimal(12, 2)

resexempt decimal(12, 2)

cpa decimal(12, 2)

code_enforcement_tax decimal(12, 2)

38D_fine decimal(12, 2)

sidewalk_betterment decimal(12, 2)

street_betterment decimal(12, 2)

bill_number int

value_history

This table is accessed from default.asp.

ColumnSourceNotes

Parcel_id nchar(10)

Fiscal_Year smallint

Assessed_value bigint

Land_use nvarchar(4)

Updating Database Tables

As noted elsewhere, data for the MS SQL databases are provided by Assessing in MS Access database/s.

The number of rows in the database tables is high (e.g. 150k - 400k records) and the data size of the tables can be high (30 - 500 MB).

This means a strategy for updating the SQL database with the source data needs to accommodate the size of the import, and the time it will take to import.

  1. Request a new assessingupdates20YYQX database be created for data import.

    a. In Q1 this should be a copy of the previous Q3 database. b. in Q3 this can be an empty database.

  2. Extract the schema from Access database and use to create new import tables in the new database.

  3. Export the data from each of the source tables in the MS Access database as a series of INSERT statements.

  4. Manipulate the data from the working tables into the "permanent" tables in assessingupdates20YYQX.

In 12/2023 for FY2024 Q3 a script was created (intended to run on a linux workstation or in a WSL2 session on Windows). The constants from line 13-22 in the script need to be chaked and updated as needed.

Assuming the import is being performed on a Linux computer or Windows computer in a WSL2 session, with the /wwwcob/assessing/search forlder copied/cloned locally - to run the script:

# Install mdbtools, a suite of cli scripts to manipulate access databases on 
# linux/mac/WSL2

sudo apt-get update && sudo apt-get install mdbtools 

 . extract.sh

Last updated