I have a set of data, with columns x and y. This set contains rows where, for any 2 given values, A and B, there is a row with A and B in columns x and y respectivly and there will be a second row with B and A in columns x and y respectivly.
E.g
**Column X** **Column Y**
Row 1 A B
Row 2 ...
For our SQL Server database, we're using a versioning scheme to track schema updates. The idea is that you should be able to run this script to bring the schema from any previous version up to the current version. Running the master script again should only execute the newest schema updates.
The structure of the script is like this:
...
hi guys,
I have a field in table.Suppose its value is 2009/1234.I want to get digits before'/'.I want to do this in stored procedure in sql.Can anybody help?
...
Hi
I have problem with SQL Server 2000 and queries that contain a large number of conditions. When these queries are sent to the SQL Server I get one of the following error messages depending on the query (error messages edited for readability):
[Microsoft][ODBC SQL Server Driver][SQL Server]
SqlDumpExceptionHandler:
Process 61 genera...
hi i am a beginner with sql server 2008, i was trying to add a file to a filegroup so that i an create a table which uses filestream, but i keep getting an errors.
here is the code that i am trying:
ALTER DATABASE dbtry1
ADD FILEGROUP dbtry1_fg_filestream CONTAINS FILESTREAM
GO
ALTER DATABASE dbtry1
ADD FILE
(
NAME= 'dbtry1_files...
Which Join having more I/O and CPU Cycle ?
Hash join or Merge join or Loop join?
...
I have a table like this...
CustomerID DBColumnName Data
--------------------------------------
1 FirstName Joe
1 MiddleName S
1 LastName Smith
1 Date 12/12/2009
2 FirstName Sam
2 MiddleName S
2 LastName Freddrick
2 ...
I have the following table
EVENT_LOG:
EVENT_ID: pk, int, not null
TYPEID: fk, int, not null
CATEGORYID: fk, int, null
SOURCE: varchar(255), null
DESCRIPTION: varchar(4000), null
CREATED: datetime, null
We've been creating a report, and found that performance sucks. There aren't any indexes aside from the clustered one. We could cr...
Hi, what is the short cut to get entire text of the stored proc in query analyzer. I know that I could highlight table name and hit <alt><f1> and get the entire table structure.
...
So, how can I drop all indexes in a SQL database with one command? I have this command that will get me all the 20 or so drop statements, but how can I run all of those drop statements from this "result set"?
select * from vw_drop_idnex;
Another variation that gives me the same list is:
SELECT 'DROP INDEX ' + ix.Name + ' ON ' + OB...
I'm very new to Stored Procedures.
Say I have a IDCategory (int) and I pass that to a stored procedure. In normal-talk, it'd go:
Find me all the listings with an
IDCategory equal to the IDCategory I'm
telling you to find.
So it would find say 3 listing, and create a table with columns:
IDListing, IDCategory, Price, Seller, Im...
Hello SQL Gurus, I am from procedure programming background, end up writing TSQL recently with my new job. My mindset still thinking about writing queries with if conditions. How to avoid following query without if condition.
DECLARE @NumAddress INT
SELECT
@NumAddress = COUNT(*)
FROM Address
WHERE UserID = 1001
IF @NumAddress ...
i'm trying to set up some tables in my SQL Express server, and i want to do something to the effect of this:
create table programs (
progid int primary key identity(1,1),
name nvarchar(255),
description nvarchar(500),
iconFile nvarchar(255),
installScript nvarchar(255)
)
however i want each "program" to have a set ...
I'm having trouble with stored procedure here and I'm not sure what to do or how to approach this. I'm sure there's a genius out here that can help me out! :D
I want my stored procedure to return Anuncio's idAnuncio, titulo, precio, descripcion, and by using it's foreign keys return Categoria's descripcion and Imagenes's imagen.
But ...
I'm having an issue where this query statement is giving me repeating GoalText in the results. Any ideas?
The complete query statement:
Select g.GoalText, convert(nvarchar, g.GoalID) + '|' + convert(nvarchar, r.GoalReqID) as GoalID, GoalReqID
from Goal g inner join GoalRequirement r
on g.GoalID = r.GoalID
where GoalReqID in
(Select...
I'm using Quest's TOAD for SQL Server on a SQL Server 2000 Server.
Here is my query:
SELECT CASE SLCE.GroupName WHEN 'Other' THEN ARM.FBCOMPANY
WHEN 'Inter Co.' THEN ARM.FBCOMPANY
ELSE SLCE.GroupName END AS [Company Name],
ARM.fcustno AS [Cust No],
ARM.fbcompany ...
I have table with 3 columns A B C.
I want to select * from this table, but ordered by a specific ordering of column A.
In other words, lets' say column A contains "stack", "over", "flow".
I want to select * from this table, and order by column A in this specific ordering: "stack", "flow", "over" - which is neither ascending nor descen...
I am working on .aspx page that uses a t-sql query that uses a multivalued input parameter (a set of labnames) using an array that would store all the labnames prior to running the query.
I have the following parameters for the query.
With c.Parameters
.Add(New SqlParameter("@sdate", sdate.text))
.Add(New SqlPar...
Executing the following statement with SQL Server 2005 (My tests are through SSMS) results in success upon first execution and failure upon subsequent executions.
IF OBJECT_ID('tempdb..#test') IS NULL
CREATE TABLE #test ( GoodColumn INT )
IF 1 = 0
SELECT BadColumn
FROM #test
What this means is that something is co...
I heard that SQL is faster if table relationships are defined.
Is this true?
Or maybe it's slower, I would like to know.
...