Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

converting the nvarchar value 'MSalreadyhavegeneration' ?

$
0
0
I've never seen this error before. I'm not sure I understand what's going on here. We have a bunch of tables in our database with accounting periods on the end of them, so <table name>_201212, <table name>_201301, <table name>_201302, etc....I have a view that selects from information_schema.tables and does a substring on these tables pulling off that period, so I can get a list of periods we have tables for. Once I have the period in the view I cast it as an int. When I look in the object explorer it shows this column as an int.When I run this query it returns a proper result:select distinct Periodfrom <table name>where Period = 201312order by 1When I run this query select distinct Periodfrom <table name>where Period >= 201312order by 1I get an error saying:Msg 245, Level 16, State 1, Line 1Conversion failed when converting the nvarchar value 'MSalreadyhavegeneration' to data type int.Hoping to get a little background here on what may be going on.

Viewing all articles
Browse latest Browse all 3145

Trending Articles