I'm trying to execute CREATE USER with a given username (via sql parameter)
exec sp_executesql N'CREATE USER @LoginName
FOR LOGIN @LoginName;',
N'@LoginName varchar(5)', @LoginName='myuser'
Heres the code thats generating the above:
Dim myCommand As SqlCommand = New SqlCommand("CREATE USER ...
Why app_offline.htm is created automatically? and my project do not work ?
...
I have a table with 3 columns. One is sessionID as int, other one sessionLength t as int and other sessionActualLength as int.
sessionLength is value calculated for time being in online chat in seconds. sessionActualLength comes in place where in certain hours users get bonuses for being online and each second of their time actually mea...
This is more of a question about best pattern and practice than asking about any one particular method. We have app that is heavily reliant on dates and times and is hosted in the US. Sometimes it needs to perform actions based on those values, like emailing out reminders and expiring "single-use" session tokens.
However there are clien...
I would like to copy one database (almost all tables) to another server. So far we have done this using the standard MSSQL wizard. We would like to include this work into an automated build we have with ant.
I have found one command line tool: http://dbcopytool.codeplex.com/
Any better ideas?
...
Hi
I have a form that allows users to insert "items" in a database. A field asks how many items they want to insert. Identical data (apart from their ID) is inserted in the database the number of times they chose. I've found different ways to insert multiple items but not when this is dynamically done. I'm using .net 3.5 and SQLServer 2...
One table with EmpSalary in Employee Table. I need to find the second largest Salary what is paid by the company.?
How to find the Second largest value(Salary) from a table.?
...
Dear All,
I am breaking my head on this issue since long. I have stored procedure in MS SQl and when I try to execute that procedure by providing all the parameters in SQL Query, it takes long time to execute but when I try to directly run the query which is there in SP it executes in no time. This is affecting my application performanc...
I need a query for SQl server 2005 (SQL server management studio express).
I have data stored as 1 minute time frame (1 minute each row), for each table columns are ID, Symbol, DateTime, Open, High, Low, Close, Volume.
I need to convert (compress) to every possibile multiple time frame, so let's say 10 minutes, 13, 15, and so on.
Provid...
Hi,
As a user with little or no experience i have to create a trigger on a table (or find another solution). What needs to be accomplished is that when the value of the column ESB is changed to '1' in another row in the table the column has to be set to '0'.
My intention was to use a AFTER UPDATE trigger, to do this.
ALTER TRIGGER [T...
Dear All, I have a problem. I havea db on the SQL 2005 and will have it replicated to 2-3 other servers but if I have stored hyperlinks that are linked to the pictures on that main server how can I make also the replication with the same setup.
Is there any way that when I move folder with the pictures to the replicated machine somehow...
I am using SQL Server 2005...
I want to monitor table1 with a trigger for an update. On the occurrence of this update, I will check another table (table2), using the data from table2 I place an item in the queue to execute at a variable date in the future. Could be 10 seconds from now, or 2 hours, this date is determined from checking...
I have got a table named student. I have written this query:
select * From student where sname in ('rajesh','rohit','rajesh')
In the above query it's returning me two records; one matching 'rajesh' and another matching: 'rohit'.
But i want there to be 3 records: 2 for 'rajesh' and 1 for 'rohit'.
Please provide me some solution or t...
How do I pass C# DateTime values (FromCreateDate and ToCreateDate) to SQL Server 2005 in order to select from a view ?
The result set CreateDate column must be between FromDateDate and ToCreateDate.
...
I have this condition in a query:
WHERE fielddate> = '2010-10-01 'AND fielddate <= '2010-10-18'
to migrate the database to another server (2008) with the same engine database (sqlserver-2005 Express), returned error:
The conversion of a char data type to
a datetime data type resulting in an
out-of-range datetime value.
But i...
Hi,
I have a whole bunch of Java beans annotated like this with JPA:
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class TitleEntry extends Entry
{
private Long id;
public TitleEntry() {}
public TitleEntry(St...
My transaction log file is full, i have 5 log files , 2 in D: drive & 3 in E: drive.
all the log file is full, each log file is 10GB in size.
I need to delete all 5 transaction log file and need to have one fresh truncation log file
i have tried method,
1. converted from Full to simple and shrik files (but not great effect , it does n...
Here is my issue. I have an account object as follows:
public class Account
{
public virtual int AccountId { get; set; }
[Required(ErrorMessage = "Email address is required.")]
public virtual string EmailAddress { get; set; }
[Required(ErrorMessage = "A password is required.")]
public virtu...
Hello.
I would like to know if there's a way to add a column to an SQL Server table after it's created and in a specific position??
Thanks.
...
I have this Stored procedure on my sql server :
[InsertRecord] @param1 varchar(10), @Param2 varchar(50),@Param3 varchar(10)=NULL,
@Param4 datetime = NULL AS BEGIN
When I update it with the following code :
connenction = pymssql.connect (host=host1,user=user1,password=password1,database=database1)
curser = connection.cursor()...