I'm working on a large SQL Server codebase, some of which has been in development since at least SQL 7 and possibly before.
Throughout the codebase, the method of raising an error is to use the following syntax which is, as far as I can tell, undocumented
RAISERROR <error number> <error message>
The error number can be any value grea...
Suppose i have two tables
declare @emp table
(
EmpID int,
EmpName varchar(10)
)
declare @Remu table
(
EmpID int,
Sal Decimal(10,2),
PaidYear varchar(10)
)
I want maximum salary grouped on PaidYear (With Ties)
Expected OUTPUT
EmpID EmpName PaidYear Sal
1 Jon 2001 2000
2 Smith 2001 2000
3 Na...
Hello,
I get the above error when trying to run my .net app as it attempts to connect to a SQL database on another server.
The SQL connection string is using a trusted connection.
IIS has anonymous access switched off, and integrated windows authentication switched on.
The user the error relates to is "DOMAINNAME\IISSERVERNAME$"
Do I...
Is there a query in SQL Server 2008 which will delete data from all dependent tables as well, along with the selected table?
My apologies for not having elaborated on the question. I know that Cascade Delete would work fine, but my application connects to a 3rd party SQL Server db. I have a few Unit Tests which insert into the target ta...
I am connecting to a MS SQL server through SQL Alchemy, using pyodbc module. Everything appears to be working fine, until I began having problems with the encodings. Some of the non-ascii characters are being replaced with '?'
The DB has a collation 'Latin1_General_CI_AS' (I've checked also the specific fields and they keep the same col...
When running a .NET 3.5 web app (C# code behind) on my local machine, I encounter error 26 "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connect...
I'm inserting large number of records using LinqToSql from C# to SqlServer 2008 express DB. It looks like the insertion is very slow in this. Following is the code snippet.
public void InsertData(int id)
{
MyDataContext dc = new MyDataContext();
List<Item> result = GetItems(id);
foreach (var item in result)
{
DbItem dbIte...
Hi,
I am wondering why the table variables inside while loop does not behave like other variables. Table variables created only once and will be used across through out whole looping. but other variables getting initialized every time when loop increases.
Check out the below code for more info
declare @tt int
set @tt =10
while @tt...
We've got some users who would like to query one of our SQL Server 2008 databases from within Excel 2010. I can see how to retrieve values from a SQL table or view from within Excel, but I cannot see how to pass SQL Server a specific query.
Thanks very much.
...
what is sqlserver T-SQL equivalent to oracles "show all" listing the set parms on the DB?
...
In SQL Server 2008 I can attach databases located only in its predefined folder (C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA). On may occasions, especially when I read a book, I need to attach test database from desktop rather then copy each database every time I need it, but SQL Server does not allow me to acces...
I need to copy a large amount (~200,000) of records between two tables inside the same SQL Server 2000 database.
I can't change the original table to include the columns I would need, so the copy is the only solution.
I made a script with insert select statement. It works, but sometimes the .net form that triggers the stored procedure ...
If I create a sqlserver db and don't enable use full text indexing, can I add it later? Currently using sqlserver 2005 but going to be upgrading to 2008.
Would there be disadvantages in terms of performance, storage space, etc in allowing for full text editing now although I wouldn't need it for a long time if ever?
...
Ok I am trying to write a query that says get the current date and make it the start date. Then I want to go a month back from that current date for the EndDate. Is it possible to do this? Like if it was 9-15-2010 as the start date can I go a month back from that to 8-15-2010 or is this no possible....what would you do for like 9-20-2010...
I have a scenario in which a C# program is going to provide a stored procedure with text, this is most probably going to be a table value where by each row is a line of text. I've found a way using dm_fts_parser to search this for keywords, the crux of which is based on something like:
WITH tab1 AS(SELECT 1 AS Id, N'Some search string' ...
This question is specific to SQL Server, but other DB replies welcome.
Read below for some history. My short question is, how does SQL Server guarantee that when I request "ABCDE" to be written to the database, that "ABCDE" is written, not "ABECD"? It has been suggested that data be re-read and compared to guarantee the same results, wi...
I'm using SQL2008 and .NET 4.
The following UPDATE query causes timeout errors.
Table Pages has 600,000 records.
Error:
System.Data.SqlClient.SqlException
(0x80131904): Timeout expired. The
timeout period elapsed prior to
completion of the operation or the
server is not responding.
Query:
UPDATE Pages
SET Checked = 1...
Greetings all,
In SQL Svr 2005 I created a new schema for my database called GSOC whose owner is dbo. I then created a local SQL user account with the default schema set to GSOC - my new schema name. I have one View that I want this schema to control access to, so I added the local SQL account to the View's permissions granting SELECT p...
When two tables are given
Employee Table
EmpID Name
1 Jon
2 Smith
3 Dana
4 Nancy
Lab Table
EmpID StartTime EndTime Date LabID
1 10:00 AM 12:15 PM 01/JAN/2000 Lab I
1 11:00 AM 14:15 PM 01/JAN/2000 Lab II
1 16:30 PM 18:30 PM 01/JAN/2000 Lab I
...
I'm trying to do the following, If a user the enters the term "IP Address Text" into my search box then I want the following SQL to be generated:
SELECT *
FROM tblComments
WHERE tblComments.Text LIKE '%IP%' OR tblComments.Text LIKE '%Address%' OR tblComments.Text LIKE '%Text%'
Obviously the number of words entered is going to be diffe...