All Questions
Tagged with t-sql database-design
44 questions
1
vote
0
answers
103
views
Remove Transactional Replication Manually or Via SSMS?
I am setting up transactional replication on my 2008R2 server to 2012 distribution server to 2012 Subscriber server. All the three servers are on FULL recovery mode. Log backup is taken every 15 ...
0
votes
1
answer
64
views
When Insert Press Name Tech Id Take Wrong Number Where Press Name Exist?
I work on SQL server 2017 I have table #Pressfeature as below
create table #Pressfeature
(
PartId int,
PressName varchar(300),
TechId int
)
insert into #Pressfeature(PartId,PressName,...
-3
votes
1
answer
2k
views
How to convert data separated pipe to rows?
I work on sql server 2017 I have table name #countriesData data as below
my issue here How to convert countries column data separated pipe to rows .
meaning every rev and company and year will have ...
1
vote
1
answer
354
views
Should I partition a database file for performance improvement if a file sits on RAID?
I read a lot about performance improvement if instead of a single large .mdf file you partition it by multiple (.ndf) files.
But I also found from documentation that the same improvement can be ...
0
votes
1
answer
66
views
Do Temporary Tables cause stored procedure Recompilations?
I have read certain articles online that creating temporary tables in stored procedures will cause stored procedure recompilations.
Could someone please explain what happens when a temporary table is ...
-1
votes
1
answer
87
views
Question about Key lookups
I have a table with 100 columns. The Primary key and clustered index are on the column Id - IX01_Id. I have a non-clustered index on Col2 - IX02_Col2.
I have 3 stored procedures that return the ...
-1
votes
1
answer
61
views
Suggestions to create a table or to design a stored procedure to remove while loops [closed]
The company I am currently working for, has a scenario for which we have to use while loops or cursors in SQL. Which has a huge performance impact in our case, hence, I want to optimize it.
The ...
0
votes
1
answer
69
views
SQL case problem [duplicate]
SELECT
CASE
WHEN OfferSum.DayOfWeek = 'Monday' THEN 'Mon'
WHEN OfferSum.DayOfWeek = 'Tuesday' THEN 'Tues'
WHEN OfferSum.DayOfWeek = 'Wednesday' THEN 'Wed'
WHEN ...
3
votes
2
answers
396
views
Keep full history of every values in each table
How would you do to keep full history of every values of all tables in a DB, which can be queried with a specific date (for each and every column of all tables)? I mean: one would just need to specify ...
0
votes
1
answer
793
views
MSSQL Join to put rows into columns column variable as column name
I have two tables
TABLE 1
PRODUCTID
TITLE
001
Product1
002
Product2
TABLE 2
ID
PRODUCTID
VARNAME
VARVALUE
1
001
url
https://...
2
001
length
30m
3
001
somethingelse
somevalue
I am trying to make a ...
0
votes
1
answer
9k
views
Database design for one payment and monthly payments
I'm working on leasing shops system and here is my database for now:
I have contracts these contracts have 2 types, lease for a duration (year) and the payment will be once, and the other type is ...
0
votes
1
answer
32
views
Query specific key fields from x-number of tables?
I'm building an insurance database and I need some help with best practice on fast quering data.
Let's say I have three insurance types ... Car, Home and Travel.
Common for all three types, I have the ...
0
votes
0
answers
31
views
How to improve query performance sort operation overloads query
I have simple database which is consist from two tables.
I want to build simple query that will return
ForumId - Forum id (Topics).
Title - Title of last post (Posts).
DateTime - Datetime of last ...
1
vote
1
answer
108
views
Designing Calendar table - datatypes
I'm in the process of designing the Calendar table. I took some inspiration from Database design book by Louis Davidson.
What I'm confused about are the data types.
Example:
MonthName varchar(10) ...
8
votes
3
answers
1k
views
How can I get running totals of recent rows faster?
I'm currently designing a transaction table. I realized that calculating running totals for each row will be needed and this might be slow in performance. So I created a table with 1 million rows for ...