Take a backup and restore it to a new database... You can do this form SQL Server Management Studio For MS SQL Server/MS SQL Server Express, from Enterprise Manager for MS SQL Server 2000 and 7.0. From Query Analyzer, SQLCMD or other sql tools; lookup BACKUP (T-SQL) and RESTORE (T-SQL) in books online or Google.
Arjan Einbu
Posts
-
copy of sql server database -
[Message Deleted]Hva you tried googling[^] any of your questions before posting them here? Google returns this article in the top 10. It has a section on pinning attributes. http://www.c-sharpcorner.com/UploadFile/rajeshvs/PointersInCSharp11112005051624AM/PointersInCSharp.aspx[^]
-
[Message Deleted]By using the return keyword: Like this:
[return: AttributeForTheReturnValue]
-
Session like variablesHave a look at the
HttpContext.Current
object. You can access your session variables through it, and create some wrapper code around your session variables. Like this:using System.Web;
public static class SessionHelper
{
public static string SomeString
{
get { return HttpContext.Current.Session["SomeString"] as string; }
set { HttpContext.Current.Session["SomeString"] = value; }
}public static int SomeNumber { get { return (int)HttpContext.Current.Session\["SomeNumber"\]; } set { HttpContext.Current.Session\["SomeNumber"\] = value; } }
}
-
How do I do this in SQLYou could create the inner query like this:
SELECT oi.CustomerID
FROM OrderItems oi
JOIN Products p
WHERE p.ProductID IN ('Product1', 'Product2')
GROUP BY oi.CustomerID
HAVING COUNT(*) = 2You'll have to dynamically create the
WHERE p.ProductID IN (...)
part, and the value for theHAVING COUNT(*) = 2
should use a parameter. Joined with the customer table, the results could look something like this:DECLARE @NumberOfProducts int
SET @NumberOfProducts = 2SELECT
c.*
FROM Customer c
JOIN
(
SELECT oi.CustomerID
FROM OrderItems oi
JOIN Products p
WHERE p.ProductID IN ('Product1', 'Product2')
GROUP BY oi.CustomerID
HAVING COUNT(*) = @NumberOfProducts
) AS t
ON t.CustomerID = c.CustomerID -
How do I do this in SQLThis can't possibly work, can it? I mean, the
WHERE [Name] IN (@Products)
part specifically. -
avoid .net reflectorYou can obfuscate the assembly. VS2005 includes a Dotfuscator Community Edition (light version). Many other obfuscator tools exist with prices from a couple of hundred to several thousand USD. (See also this Google search[^].)
-
count queryYou're right! I've should've seen that. It can't possibly work... Will something like this work?
SELECT y1.Username
FROM your_table y1
LEFT JOIN your_table y2
ON y1.Username = y2.Username
WHERE y2.date BETWEEN start AND end
GROUP BY y1.Username
HAVING COUNT(y2.Username) = 0The table alias
y1
represent all usernames andy2
represent only the records within the requested range. -
count queryYou can use
GROUP BY
with theHAVING
clause.SELECT username
FROM your_table
GROUP BY username
HAVING COUNT(*) = 0 -
default accessibilityDefault accessibility is private for everything but namespace elements. That means classes, structs, delegates or enums that are not defined within another class are by default internal. In all other cases accessibility defaults to private. In your case, the
myClass
andMainConsole
classes are internal. -
[Solved] WS-E 2.0 problem: "Creation time in the timestamp can not be in the future" [modified]Hi! I'm calling on a webservice with WS-E 2.0 (because I need to use Dime), and the server returns this exception message:
Microsoft.Web.Services2.Security.SecurityFault: An error was discovered processing the <Security> header ---> System.Exception: Creation time in the timestamp can not be in the future.
I've allready checked that the clock on both machines are in sync (also the same timezone). I've also tried different combinations of setting the <timeToleranceInSeconds> and the <defaultTtlInSeconds> settings in both the clients app.config file and the servers web.config file. still gets me the same exception... Does anyone here have any suggestions on how to fix this? -- modified at 9:53 Thursday 15th June, 2006 Found it... While trying to fix this problem, I had inadvertenly cleared the Security collection of the SoapRequestHeader, so that the other two fixes didn't seem to work... Well, they did work, after removing that statement.
-
Get XML node as 'text' data typeTry
varchar(MAX)
instead oftext
. -
Sql multiple queries [modified]SQL Server 2005 supports having multiple readers open at the same time. (A feature called MARS). You need to add
MultipleActiveResultSets=True
to the connectionstring to make this work for your connection.string connectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;IntegratedSecurity=SSPI;MultipleActiveResultSets=True";
-
Sql DatetimeHave you had a look at at the actual SQL string produced by your string concatenation? I'm guessing there's a format mismatch, maybe due to some regional settings or something. (Often a problem when putting datetimes into the db like this.) A safe and easy way to fix this would be to use parameters in your SQL query:
string query = @"
INSERT INTO orders (date,customerid,productid,sum)
VALUES (@date, @customerid, @sum)
";
SqlCommand cmd = new SqlCommand(query, con);
cmd.Parameters.Add("@date", DateTime.Now);
cmd.Parameters.Add("@customerid", customerid);
cmd.Parameters.Add("@sum", sum);
cmd.ExecuteNonScalar(); -
Autologon OK, now how do you turn it off??Take a look at the parameters of Shutdown.exe (
shutdown.exe /?
) or run it in interactive mode (ie. with a GUI)(shutdown.exe \i
). It lets you connect to and shutdown remote PCs... -
Cannot store 2000 characters in varchar(7000)What version of SQL Server? If SQL 2000, is the row size within the page limit? In MS SQL Server versions prior to 2005, one row's data is limited to fit in one page or an 8kb block. (But the definition of a table can show a total of more than 8kb per row if you have one or more variable length columns.)
-
Tell me what laptop to buy [modified]I'm quite happy with my HP Compaq NC8230. Powerfull and good value for money. Also looked at DELL and IBM before settling on the HP.
-
Anybody want an hour of sleep???peterchen wrote:
WITHOUT PAYING INTEREST
Interest is payed every 4 years at the end of february... :-D
-
Does J.K Rowling exist?Aftenposten is Norways second largest newspaper... (Its generally regarded as a serious one too...)
-
using the osql commandIn Enterprise Manager: Expand the server your trying to access, then expand the Security node and click on the Logins node under Security. Here you can create a new login with Windows Authentication. -a