Hi All,
I'm trying to do precedence matching on a table within a stored procedure. The requirements are a bit tricky to explain, but hopefully this will make sense. Let's say we have a table called books, with id, author, title, date, and pages fields.
We also have a stored procedure that will match a query with ONE row in the table.
...
I have an international company that has recently been added, which is named "BLA "BLAHBLAH" Ltd. (The double quotes are part of the name. )
Whenever a user tries to search for this company, by entering "Blah, or something to that affect, the search fails with a syntax error in SQL server.
How can I escape this so the search will not f...
In SQL server you can use the DATENAME function to get the day of week as a string
declare @date datetime
set @date = '12/16/08'
select datename(dw, @date)
which returns "Tuesday"
and you can use the DATEPART function to get the day of week as an integer
declare @date datetime
set @date = '12/16/08'
select datepart(dw, @date)
Whic...
Background:
I'm working with a program coded in C++ which uses ODBC on SQL Native Client to establish connections to interact with a SQL Server 2000 database.
Problem:
My connections are abstracted into an object which opens a connection when the object is instantiated and closes the connection when the object is destroyed. I can see t...
We're doing a full backup of each of our production databases every night.
We also have an hour replication occuring during the day to a report database.
It looks like the unc share ran out of space today. Is there an automated delete feature for the replication files? Or do I need to manually delete the replication folders that I no...
When restoring a full DB backup to a different SQL Server 2005 Express server, I receive the following message:
The file or filegroup "mydatabase_log"
cannot be selected for this operation.
RESTORE DATABASE is terminating
abnormally. (Microsoft SQL Server,
Error: 3219)
I've checked the restore options to make sure that file...
I have a Master Detail relationship configured. The hbm file is below. When I run some code like this
Favourite favourite = favourites.Find(f => f.Id== id);
user.Favourites.Remove(favourite);
m_UserRepository.Save(ref user);
I get the error message
NHibernate.Exceptions.GenericADOException: could not delete collection rows: [Model.En...
Hi All --
I recently resolved an issue my VB6 application had when saving large binary objects to sql server using ADO 2.8 and the AppendChunck method for Recordset.Field. If the data was too big I would get either 'Invalid Handle' in a for loop or 'Not enough system storage to perform this operation'. I fixed the issue by sending chu...
A simple stupid "UPDATE table SET something=another WHERE (always true)" in accident will easily destroy everything in the database. It could be a human mistake, an SQL injection/overflow/truncation attack, or a bug in the code who build the WHERE causes.
Are popular databases provide a feature that protect tables by limit maximum numbe...
I'm looking at writing a tool for generating code based on the contents of a stored procedure. Like the parameters and stuff.
I was wondering if anybody knew of an open source library that has a all the regex's and stuff to parse all this easily.
Thanks.
...
Is there a way to restore an Sql Server 2005 DB to Sql Server 2000? I'm unable to attach it either. Any tools, ideas etc?
...
I have a small app/site on a dev server with a data table in SQL Server [varchar(40),varchar(40),varchar(MAX)]. I want to take the data table and push it to the live server. I have tried exporting in txt, Excel and Access but every time there is an error on import related to not being able to parse due to the data in the varchar(MAX) fie...
Hi All,
My question really has three related parts which I hope you can help me clear up -
Do I need to enable a Service Broker endpoint on SQL 2005 to use the SQLCacheDependency mechanism?
If so, is there a specific port that needs to be used?
If neither of the web server machine and sql server are in a domain, what type of authentic...
I can use
select * from sys.tables
in mssql to show a list of all tables in the current database. Is there anyways I can use similar syntax to show list of tables in another database?
Say I am using A with
use A
statement, can I show tables in database B?
...
Is there a setting in SQL Server to have null = null evaluate to true?
...
It seems to be a common requirement nowadays to have a search feature that can search almost anything you want. Can anyone give me samples or tips as to how to go about building a one stop search for an application?
For example: you have 3 tables customers, products, employees. The application has a master page that has a textbox at the...
I'm looking for ways to display a single row of data as a single column (with multiple rows). For example,
FieldA FieldB
------- ---------
1 Some Text [row]
Header Value [col]
------ ------
FieldA 1 [row1]
FieldB SomeText [row2]
Is there a way to do this with SQL Server 2005?
...
Hey everyone!
I've got a sproc (MSSQL 2k5) that will take a variable for a LIKE claus like so:
DECLARE @SearchLetter2 char(1)
SET @SearchLetter = 't'
SET @SearchLetter2 = @SearchLetter + '%'
SELECT *
FROM BrandNames
WHERE [Name] LIKE @SearchLetter2 and IsVisible = 1
--WHERE [Name] LIKE 't%' and IsVisible = 1
ORDER ...
I have a single windows shell command I'd like to run (via EXEC master..xp_cmdshell) once for each row in a table. I'm using information from various fields to build the command output.
I'm relativity new to writing T-SQL programs (as opposed to individual queries) and can't quite get my head around the syntax for this, or if it's even...
What is the difference between a Function and a Procedure in SQL Server?
...