Microsoft's SQL Server is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. It originated from the Sybase SQL Server codebase, which is why both products use the extension of SQL called Transact-SQL (T-SQL).
1
vote
1answer
26 views
SQL iteration-Insertion plus renaming
Base Info
Two tables: tData, tData2
Exactly the same columns
About 200,000 records
SQL Server 2008 R2
Logic
At first sight we need to insert tData rows into tData2. What else?
We need a ...
2
votes
1answer
103 views
PHP Login/User Creation Validation Function
I'm VERY new to PHP and have begun writing a basic login for a website that uses data from a Microsoft SQL server to display information on the web. Below are 3 snippets of code (two functions from ...
0
votes
1answer
62 views
Data Structure for Categories and SubCategories
I have this relationship:
Many Objects to One Category
One Category to Many SubCategories
I am looking for the best way to store this in my Relational Database? Here were some of the ways I was ...
3
votes
2answers
214 views
Which SQL statement is faster
My co-worker claims that using a parameterized Like statement is equivalent to dynamic sql and won't have its execution plan cached for reuse. He says that using sp_executesql will allow the execution ...
3
votes
1answer
123 views
Getting rows from several tables where one table doesn't include the rows from the next tables
I have some entity that is spread across three tables.
I have to get in a single result the following values:
All the values that are in the first table but not on the second nor the third.
All ...
0
votes
0answers
43 views
How to refactor this cursor used in a SQL query
So I got this query from another analyst here and I'm a little stumped as to why a cursor was used instead of just joins. Could I please have some help trying to refactor it? I am using MSSQL 2008.
...
5
votes
1answer
152 views
Conditional Create: must be the only statement in the batch
I only want to create this SQL function if the dependent Assembly exists.
I can do it using dynamic SQL, but it seems messy and I lose syntax checking (in
management studio). This function's ...
0
votes
2answers
144 views
Critique my Database design/help me simplify my C# code please
I wish to create a database for a webpage where users are able to add their own events to a timetable. Users will be able to decide if the events should be recurring (weekly) or not. Users should be ...
2
votes
1answer
94 views
Refactor my simple SQL Statement
I have the following SQL statement that I think could be improved in areas (I believe there may be a way to use where over having, but I'm not sure how and I'm sure there's a way to reference the last ...
3
votes
1answer
57 views
output parameter and exists condition
I want to return title of a record if exists or the word 'invalid' if not.
@ID int ,
@Title nvarchar(50) output
...
if exists(select * from MyTable where ID=@ID)
select @Title = ...
0
votes
1answer
51 views
SQL table normalization upto what extent
I have an asp.net form which contains like 5 tabs and each tab has at least 15 fields in it. They all belong to one record so for the sake of simplicity lets call the PK as RecordId. Now i have 2 ...
2
votes
1answer
87 views
Slow Oracle to MSSQL migration
I wrote a method that gathers data from an Oracle server, formats and encrypts the data then inserts it into a MS SQL server. The method moves about 60000 records and takes a bit long and is a little ...
2
votes
1answer
62 views
Critique my SQL
Table Structure
ApprovalOrder int
EntityCode varchar
CostCentre varchar
DelegationCode varchar
ProjectCode varchar
RoleGroup varchar
Position varchar
...
1
vote
3answers
148 views
How can I improve this sorting algorithm?
I have a table in a SQL Server database, which holds information of some images, and the relevant gallery of them. The columns are like:
ImageId, GalleryId, Order
I have a unique key on ...
1
vote
2answers
115 views
SQL - Refactoring - How can this be done better?
I've been working on a semi-awkward query in that it uses a very high number of functions given its relatively small size and scope. I was hoping to get some feedback on any ways I could format or ...