Need to query my SQL server from Access using an ADO connection (for example), and then using something like:
Currentdb.CreateTableDef()
in Access to create a table (in Access) with the query results.
How can I do this?
...
Language is vbscript and classic ASP.
The following SQL works when values are hard coded in the sql statement:
sql = "UPDATE STORE2_ITEM SET sku = 'abcd' WHERE id = 224 and host_id = 1"
What I'm trying to do is add parameters so I replaced the field1 assignment with the following:
sql = "UPDATE STORE2_ITEM SET sku = ? WHERE id = 224...
How can I use DATEDIFF to return the difference between two dates in years, months and days in SQL Server 2005
DATEDIFF (date , date)
How to result that: 2 year 3 month 10 day
Can anyone complete this t-sql?
ALTER FUNCTION [dbo].[gatYMD](@dstart VARCHAR(50), @dend VARCHAR(50))
RETURNS VARCHAR(50) AS
BEGIN
DECLARE @yy INT
DEC...
i am trying to do the "getting started" from castle active record, now i got into this problem could not execute query exception
select count(*) as col_0_0_ from User user0_ where 1=1
//it's SQL Server 2008
question: can i somehow make castle put the table name into [ ] like [User]
...
By default, when one tells SQL Server (currently using 2008) to Full-Text index a column, it treats characters such as "@" and "." as work-breakers, similarly to " ".
I'd like to restrict the work-breaking characters to just be " ", so that "[email protected]" is treated as a single word.
It appears that one can choose a "Langua...
I want to query Active Directory from SQL Server like this, but retrieving only current users. I presume the way to do this is to check the 'accountExpires' field.
This is made slightly tricky since dates in AD are stored as the number of 100 nanosecond intervals since January 1, 1601 (UTC). In the accountExpires field a value of 0 or...
Is it possible in SQL (SQL Server) to retrieve the next ID (integer) from an identity column in a table before, and without actually, inserting a row? This is not necessarily the highest ID plus 1 if the most recent row was deleted.
I ask this because we occassionally have to update a live DB with new rows. The ID of the row is used in ...
I need to backup SQL Server database.
Is it possible to do this automatically without human intervention at regular intervals? If so yes then please suggest me how to do it and I'm using SQL Server 2005 Express Edition.
...
SQL Server 2000
Table1
ID Date Workedtime
001 23-02-2009 08:00:00
001 24-02-2009 15:00:00
001 25-02-2009 17:00:00
002 ...
So on..,
Table2
ID FromDate ToDate
001 24-02-2009 25-02-2009
002 27-02-2009 03-03-2009
...
I want to compare the table1 date and ID with Table2 ID FromDate, ToDate, means
Table1 Date compare with FromDate T...
Looking at the related questions, I don't think this specific question has been asked, so here goes.
I had a situation where I joined on a table three times to get different data based on dates.
This took too long, so in an effort to optimize, I rewrote it using a group by as defined here: http://weblogs.sqlteam.com/jeffs/jeffs/archive...
I want to have a database table that keeps data with revision history (like pages on Wikipedia). I thought that a good idea would be to have two columns that identify the row: (name, version). So a sample table would look like this:
TABLE PERSONS:
id: int,
name: varchar(30),
version: int,
... // some data assigne...
Hi friends,
Below is my query
select
@monNameStr as [MName],
IsNull(count(c.AssignmentID),0),
IsNull(sum(s.ACV),0),
IsNull(sum(s.GrossReturn),0),
IsNull(sum(s.NetReturn),0),
IsNull(avg(a.Total),0)
FROM
dbo.Assignment_ClaimInfo c,
dbo.Assignment_SettlementInfo s,
db...
I have a database server with few main databases, and few dozens of small ones.
These small databases are kind of intermediary/staging databases for data import from various sources into main database. Data import is a daily task. They are all quite similar in structure as the implementation of these data imports are similar, so basical...
I want to take a poorly designed SQL statement that's embedded in C# code and rewrite it as a stored procedure (presumably), and am looking for an appropriate means to address the following pattern:
sql = "SELECT <whatever> FROM <table> WHERE 1=1";
if ( someCodition.HasValue )
{
sql += " AND <some-field> = " + someCondition.Value;
...
My table looks like this:
c1 c2 c3
a 1 2000
a 2 2001
a 3 3000
a 4 3001
a 5 3002
Step 1: delete rows where c3 = 2000, 2001
Delete table where c3 like '2___'
Step 2: change 3000 to 2000, 3001 to 2001, 3002 to 2002, and so forth
I'm stuck here. I'd appreciate any pointers or examples.
...
Sometimes we have upwards to 4-6 people either RDPed looking at data in SQL Management Studio, or hitting the server with LINQpad, Toad, etc from various locations while developing in mostly ASP.NET and Flex with WebOrb. Is this bad? Bad in the sense that we are trying to keep our live production app stable and as lag free as possible fo...
Could not connect to SQL server while using web service. I get the following error:
System.Web.Services.Protocols.SoapException: Server was unable to process request.
---> System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be cau...
It is a simple query, how to set-up fulltext search on xml column in SQL Server 2008.
...
When generating code/scripts,
why does SQL Server Management Studio generate code using square brackets and not double-quotes?
SELECT [NAME] FROM [TABLE]
and is there a way (setting/registry entry) to configure it to use double-quotes (the standard) instead?
SELECT "NAME" FROM "TABLE"
This is very MSFT-ty feature, given that all th...
I've seen a few different versions of this question but having difficulty applying it to what I need...
MS SQL Server 2008 query:
SELECT Receipts.ReceiptID, Receipts.UserID, Receipts.UserCardID, FolderLink.ReceiptFolderLinkID
FROM dbo.tbl_ReceiptFolderLnk AS FolderLink
INNER JOIN dbo.tbl_Receipt AS Receipts ON FolderLink.ReceiptID...