I'm trying to add a Foreign Key to a table, but database, Sql Server 2005, does not like it.
It says that columns do not match an existing primary key or unique constraint.
How can I find the columns in question so I can delete/change them and add the foreign key?
...
I am looking to learn more about full text indexing and I am looking for more information than is available in SQL Books online or at least something that presents full text indexing in a different way. Does anyone have any recommendations on books.
...
Hi,
I've got an C# .Net 3.5 executable that runs on a local machine and makes database calls to a server running SQL Server 2005. I've added a System DSN using the Data Sources manager on the local machine called "localserver" (with the driver set to SQL Server). When I create the DSN, I can test the connection to the server successfu...
Greetings.
For the life of me, I can't remember how to set the minimum width on an SSRS column. When I render the report in 'Preview' mode it looks fine, but when I set it up as a subscription to go out via email it gets scrunched together.
Appreciate any help. Thanks!
...
We have an access front-end tied to a sql server 2005 back end. We have no trouble with any users accessing the interfaces with the exception of one.
When trying to interact with the interfaces we get a SQL Server Connection Error telling us that the user is not associated with the trusted sql server connection.
We are use mixed mode a...
I am doing a query
SELECT object_name(object_id, database_id) as objectname), index_id, *
FROM sys.dm_db_index_usage_stats
Is there a SQL function I can use to convert the index_id to the index name?
...
I have a table that has data that maps to fields in other tables in the database. Something like this:
FieldName isNeeded
CUSTNAME 0
PRODQTY 1
The MYFIELD1 and MYFIELD2 maps to fields in other tables. In a SQL Script, I would like to get the field definition such as type, length (info that we get we run a sp_help ...
We have a daily maintenance plan in SQL Server 2005 that performs a full backup to disk using the "Back Up Database Task".
"Verify backup integrity" is enabled but from what I understand data integrity is only validated if the backup media contains a checksum, which is enabled by the "WITH CHECKSUM" option during the backup. I can see ...
I need to format data in a sql column that is currently entered like this:
Z04000002003.7
The desired output of this would be:
Z04/000/002/003.7
Every time a user enters data like this Z04000002003.7. The next time the user opens the record it would have automatically formatted it to display Z04/000/002/003.7.
...
I have a table in a database where one of the columns should have a value from 1 to 5. How can I write this limitation into the database? Do I use a constraint? What's the best practice say about this kind of thing?
I am using SQL Server 2005
...
I would like to know how (and by extension if it's possible) to put SQL Server 2005 in single user mode using SQL statements?
I found these instructions on the MSDN, but alas they require SSMS.
http://msdn.microsoft.com/en-us/library/ms345598(SQL.90,loband).aspx
*To set a database to single-user mode
In Object Explorer, connect to...
Sorry, but I am new to TSQL so I don't even know basic things. I've been working on this function, but I've been running into a lot of syntax issues. If someone can assist me in writing this function, I would appreciate it.
1. I would like it to check for the existence of a table before attempting to drop the table
2. I would like ...
Hello All,
I run a medium sized website on an ASP.net platform and using MS SQL server to store the data.
My current site stats are:
~ 6000 Page Views a day
~ 10 tables in the SQL server with around 1000 rows per table
~ 4 queries per page served
The hosting machine has 1GB RAM
I expect by the end of 2009 to hit around:
~ 20,000...
I have an insert SP which takes many parameters, 2 of them are @FirstName, @LastName.
And have another update SP which takes manay parameters, 2 of them are @FirstName, @LastName.
What i want to do is:
from inside the insert SP "at its end", call the update SP and send to it the @FirstName, @LastName.
I don't know the right syntax to d...
Why can't I create a constraint on an nvarchar(max) column? SQL Server will not allow me to put a unique constraint on it. But, it allows me to create a unique constraint on an nvarchar(100) column.
Both of these columns are NOT NULL. Is there any reason I can't add a constraint to the nvarchar(max) column?
...
How can I connect to a Crystal Reports 4.6 report that connects to SQL Server 2005 as a data source, using Visual Basic?
I don't want to specify the connection string in the report. I want to pass the connection from VB. Is there any way to do this?
...
I have a table and I want to get the row before the last one.
Eg
KeyboardID KeyboardName
1 "DELL"
2 "HP"
3 "Viewsonic"
4 "Samsung"
select max(keyboardid) from keyboard -> will get the Samsung
My Question is how to get the Viewsonic Keyboard...
...
I am trying to call a bash command through a user account with PsExec. Cygwin is being used, and I am trying to run a command from SQL:
exec master..xp_cmdshell 'psexec -u cyg_server -p <pwd> -accepteula "bash script.sh"';
However, I get the following error from psexec:
Access is denied.
PsExec could not start bash script.sh...
Hi Guys
On my test DB, the dates are displayed in a DD/MM/YYYY format. By displayed I mean when you right click, open table in Management Studio, the returned data are displayed in a DD/MM/YYYY format.
Funny thing is, when I write T-SQL to retrieve records, I have to input a MM/DD/YYYY format to get back the right data. Is there anyway...
I need to do this for a whole DB column foo:
Regex regex = new Regex(@"^([A-Z][A-Z])(\d{6})$");
foo = regex.Replace(foo, "${1}0${2}"));
What is the simplest way to do this? I'm completely alien to MS SQL Server programming, and to C#, actually. Can I get the job done without preliminary 200 hours of CLR/MS SQL Server/T-SQL training?
...