Click here to Skip to main content
15,910,277 members
Home / Discussions / Database
   

Database

 
GeneralRe: Display records based on selected date range in months within same year? Pin
Richard MacCutchan22-Jan-24 21:47
mveRichard MacCutchan22-Jan-24 21:47 
GeneralRe: Display records based on selected date range in months within same year? Pin
samflex23-Jan-24 13:44
samflex23-Jan-24 13:44 
GeneralRe: Display records based on selected date range in months within same year? Pin
jschell23-Jan-24 5:55
jschell23-Jan-24 5:55 
Questiontime-consuming insert operation Pin
mike741118-Jan-24 16:25
mike741118-Jan-24 16:25 
AnswerRe: time-consuming insert operation Pin
Eddy Vluggen18-Jan-24 16:41
professionalEddy Vluggen18-Jan-24 16:41 
AnswerRe: time-consuming insert operation Pin
jschell19-Jan-24 4:40
jschell19-Jan-24 4:40 
AnswerRe: time-consuming insert operation Pin
RedDk12-May-24 9:38
RedDk12-May-24 9:38 
QuestionCREATE INDEX Pin
mike741117-Jan-24 17:22
mike741117-Jan-24 17:22 
AnswerRe: CREATE INDEX Pin
Victor Nijegorodov17-Jan-24 20:37
Victor Nijegorodov17-Jan-24 20:37 
AnswerRe: CREATE INDEX Pin
jschell18-Jan-24 4:44
jschell18-Jan-24 4:44 
AnswerRe: CREATE INDEX Pin
Eddy Vluggen18-Jan-24 7:38
professionalEddy Vluggen18-Jan-24 7:38 
QuestionSQL behind the scenes Pin
mike741116-Jan-24 17:02
mike741116-Jan-24 17:02 
AnswerRe: SQL behind the scenes Pin
Richard MacCutchan16-Jan-24 21:54
mveRichard MacCutchan16-Jan-24 21:54 
AnswerRe: SQL behind the scenes Pin
Eddy Vluggen16-Jan-24 22:40
professionalEddy Vluggen16-Jan-24 22:40 
AnswerRe: SQL behind the scenes Pin
jschell17-Jan-24 4:29
jschell17-Jan-24 4:29 
AnswerRe: SQL behind the scenes Pin
RedDk17-Jan-24 8:30
RedDk17-Jan-24 8:30 
AnswerRe: SQL behind the scenes Pin
Eddy Vluggen18-Jan-24 7:33
professionalEddy Vluggen18-Jan-24 7:33 
GeneralRe: SQL behind the scenes Pin
jschell19-Jan-24 4:52
jschell19-Jan-24 4:52 
QuestionRe: SQL behind the scenes Pin
Eddy Vluggen10-Feb-24 10:08
professionalEddy Vluggen10-Feb-24 10:08 
QuestionSql Server Database goes into Recovery mode Pin
Nilesh M. Prajapati17-Nov-23 17:59
Nilesh M. Prajapati17-Nov-23 17:59 
AnswerRe: Sql Server Database goes into Recovery mode Pin
Andre Oosthuizen18-Nov-23 7:35
mveAndre Oosthuizen18-Nov-23 7:35 
AnswerRe: Sql Server Database goes into Recovery mode Pin
Mycroft Holmes18-Nov-23 11:38
professionalMycroft Holmes18-Nov-23 11:38 
AnswerRe: Sql Server Database goes into Recovery mode Pin
CHill6020-Nov-23 4:10
mveCHill6020-Nov-23 4:10 
As has already been pointed out to you, that design is a bad idea. See SQL Server: The Problems of Having Thousands of Databases on a Single Instance[^]
It's bad for lots of other reasons too. Say you wanted to produce some MI for an entire year's worth of data for your application. You would have to query 12 separate databases ending up with something like
SQL
SELECT Col1, Col2 FROM DB1.dbo.MyTable
UNION ALL
SELECT Col1, Col2 FROM DB2.dbo.MyTable
UNION ALL
SELECT Col1, Col2 FROM DB3.dbo.MyTable
UNION ALL
SELECT Col1, Col2 FROM DB5.dbo.MyTable
UNION ALL
SELECT Col1, Col2 FROM DB6.dbo.MyTable
UNION ALL
SELECT Col1, Col2 FROM DB7.dbo.MyTable
UNION ALL
SELECT Col1, Col2 FROM DB8.dbo.MyTable
UNION ALL
SELECT Col1, Col2 FROM DB9.dbo.MyTable
UNION ALL
SELECT Col1, Col2 FROM DB10.dbo.MyTable
UNION ALL
SELECT Col1, Col2 FROM DB11.dbo.MyTable
UNION ALL
SELECT Col1, Col2 FROM DB12.dbo.MyTable;
And did you spot my deliberate mistake?

Even if you have a new table in the same database each month it doesn't really get any better...
SQL
SELECT Col1, Col2 FROM MyTable01
UNION ALL
SELECT Col1, Col2 FROM MyTable02
UNION ALL
SELECT Col1, Col2 FROM MyTable03
UNION ALL
SELECT Col1, Col2 FROM MyTable04
UNION ALL
SELECT Col1, Col2 FROM MyTable06
UNION ALL
SELECT Col1, Col2 FROM MyTable08
UNION ALL
SELECT Col1, Col2 FROM MyTable09
UNION ALL
SELECT Col1, Col2 FROM MyTable10
UNION ALL
SELECT Col1, Col2 FROM MyTable11
UNION ALL
SELECT Col1, Col2 FROM MyTable12;
But introduce a Date column into your table and suddenly your code becomes so much clearer
SQL
SELECT Col1, Col2, YEAR(MyDate), MONTH(MyDate) FROM MyTable;
Next steps are to look at normalizing your single table - see Database normalization description - Microsoft 365 Apps | Microsoft Learn[^] for some starters.

Address these sort of problems first, to take some of the heavy lifting off your SQL Server instance and you might very well cure what ever it is that is going wrong for you.

Failing that you are going to have to examine the Windows Application log to find out more - View the Windows application log (Windows) - SQL Server | Microsoft Learn[^]
AnswerRe: Sql Server Database goes into Recovery mode Pin
jschell20-Nov-23 7:48
jschell20-Nov-23 7:48 
QuestionSQLite Thread Safety Pin
Richard Andrew x6410-Nov-23 12:23
professionalRichard Andrew x6410-Nov-23 12:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.