Tagged Questions

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).

learn more… | top users | synonyms (1)

3
votes
1answer
38 views

Is it necessary to replace this cursor in SQL Server 2005?

The Problem I have a cursor that I am trying to replace (perhaps unnecessarily) in an attempt to clean up a stored procedure. Essentially what it is doing is counting each note for each member in a ...
4
votes
0answers
38 views

Auditing a complex mix of reasonably small tables

I plan to use the following approach to audit the tables that represent user-editable configuration of an automated system (over the course of system's life these will be inevitably extended in their ...
3
votes
1answer
82 views

SQL view, better way?

I there a better way to write this query? I feel sure it can be done in one statement with joins, but I couldn't get it, and I'm afraid I've made it too slow. What suggestions do you have? I'm ...
2
votes
3answers
117 views

SQL Server Split function optimized

I know there are some answers about a user function to split chars and I have one already running (found one years ago in the net and modified it to my own needs). Since I use this function very ...
2
votes
3answers
142 views

Search using stored procedure

I want to search a DB table and display the records in a gridview below is my stored proc create procedure search @Firstname varchar (50), @Lastname varchar (50), @Gender ...
1
vote
1answer
31 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
397 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
133 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
264 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
126 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
64 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
265 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
162 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
99 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
72 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 = ...

1 2 3
15 30 50 per page