I have table like this
create table tbl_1(
year int,
month int,
day int
)
insert into tbl_1 values(2009, 11, 30)
insert into tbl_1 values(2010, 3, 4)
insert into tbl_1 values(2011, 5, 13)
insert into tbl_1 values(20011, 12, 24)
I want to delete date from 2009-11-30 until 2011-5-13, but I can't because all of columns are i...
Hi folks,
I have been using the statement
insert into target
select * from source
where [set of conditions] for a while.
Recently found this MERGE command that will be more effective to use for my purpose so that I can change the above statement to
MERGE target
USING source ON [my condtion]
WHEN NOT MATCHED BY TARGET
THEN IN...
We are evaluating trial versions of Red Gate’s SQL Toolbelt and Quest Software’s Toad for SQL Server. What are the main differences between these tools? The benefits of using these tools are quite obvious but we are wondering which one is more suitable for a developer and development work? Is Toad for SQL Server more focused on DBA work?...
Hi all,
I'm in the process of doing a large scale server migration, as such I have to move 50+ SQL 2005 databases to a new SQL 2008 server installation.
The DB guys have only given me a backup of each database, so I have a directory with some 50 .bak files sitting in a directory (ie c:\db) that I need to restore.
I need to restore ea...
i want to insert arbitrary xml into SQL Server. The xml is contained in an XmlDocument object.
The column i want to insert into is either nvarchar, ntext, or xml column (If it makes your life easier then you can pick which type it is. Really it's an xml column).
Prototype
void SaveXmlToDatabase(DbConnection connection,
XmlDocume...
Hi I get this error when running an OPENROWSET command to import data from an xls spreadsheet into a table:
"Msg 7415, Level 16, State 1, Line 4
Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied. You must access this provider through a linked server."
I've already enabled the AdHocRemoteQueriesEnabled setting u...
I am trying to install SQL 2008 enterprise edition on window 7 machine and it fails. The error is that since visual studio has been already installed Visual studio sp1 needs to be installed. I downloaded and tried to install it and keeps on failing. Please suggest me. I would really appreciate it.
...
I have a database consisting of the following tables:
SourcesA: source, country, language
SourcesB: id, url, source
I first need to create a new table (Table1)and insert the join of the two tables where source matches.
Second table (Table2) needs to contain the records that do not match.
Third operation (Table3) is to take the fi...
I am migrating a large quantity of mostly empty tables into SQL Server 2008.
The tables are vertical partitions of one big logical table.
Problem is this logical table has more than 1024 columns.
Given that most of the fields are null, I plan to use a sparse table.
For all of my tables so far I have been using SELECT...INTO, which ha...
We're using SqlServer 2008. In SSMS, queries on the full text catalog might take 2-5 seconds the first time, but after that, return quite quickly.
On the other hand, running a query from via Linq2Sql will timeout.
Here's what we have:
The SQL Inline Table UDF
CREATE FUNCTION dbo.SearchArchiveFTS
(
@query nvarchar(255)
)
RETURN...
Hi,
Maybe this is sort of a naive question...but I think that we should always have cascading deletes and updates. But I wanted to know are there problems with it and when should we should not do it? I really can't think of a case right now where you would not want to do an cascade delete but I am sure there is one...but what about up...
Hi All,
I have the need to take the results of a query per line item and build a semi-colon delimited list of materials that make up that item.
Schema Makeup:
Tables:
LineItems (Unique Item Listing)
LineItems_Materials (Many to Many)
Materials (Unique Material Listing)
Line Items:
ID|LineItem
1|'1A.1'
LineItems_Materials:
ID|LineIt...
i have a varchar reporttime that has the date stored. dont ask me why it is a varchar
i am doing this to get data between two dates:
select rowid
from batchinfo
where CONVERT(DATE, reporttime, 103) between '2010-07-01' and '2010-07-31'
and it is not working
what am i doing wrong?
btw this is what the data looks like:
rowid da...
I have the table Tb
ID | Name | Desc
-------------------------
1 | Sample | sample desc
I want to create a trigger on INSERT that will change the value of the inserting Desc, for example:
INSERT INTO Tb(Name, Desc) VALUES ('x', 'y')
Will result in
ID | Name | Desc
-------------------------
1 | Sample | sample desc
2 | x ...
I'm implementing a Google like search box in my asp.net application. Each keypress in the box sends an Ajax request to IIS webmethod that queries the txt and return matches - works pretty cool. However, on loading up activity (e.g. 300 users), I'm getting errors that my 100 Pooled connections are used up. Now I'm rethinking that perhaps ...
I am building my wife a Contacts Manager program as a fun exercise in learning Silverlight 4. It will track peoples Addresses, Phone Numbers, Emails, Special Occasions(Birthday, Anniversary, etc)
Along the way I hit a minor road bump while designing the Database. She would like to be able to group Contacts(people) by Family so I creat...
I have a an ASP .Net MVC website which works fine when testing locally.
I have put the website onto IIS 7 on our windows server 2008 machine.
The website uses .net membership provider and when I try to login I receive the following error:
Login failed for user ''.
This is the membership connection string:
data source=(local);Integr...
Is it recommended to use two versions of SQL Server (2005 and 2008) for storing data of an application. We have a situation where we have an existing web application consuming SQL server 2005 as a database. Some enhancements in the application required us to solution a FILESTREAM data store. Now we have our data in SQL Server 2005 and as...
I use SQL 2008
I have report with few groups on the left, then some numbers and another numbers (further on the right) which has to be groupped as well.
Field1 Filed2 Filed3 Num1 Num2 Num3 Num4
fff sss aaa 1000 2000 3000 4000
bbb 2000 3000
ccc 4000 5000
i.e. Num3 and Num4 are the same for eac...
Hi
so make quick:
i use windows 7 ultimate. I can login with windows authentication mode but sql authentication with user 'sa' don't work!. sa user is enable
so what do i do?
...