sql-server

Initiate SQL Server Import/Export wizard?

Can the SQL Server Import/Export wizard be called from our windows application? ...

MySQL \G equivalent in SQL Server

How does one format wide listings vertically like in MySQL using the sqlcmd client? Or should I be using osql instead? And must I write "GO" each time to execute my query? Is there a shorthand? ...

Grant permissions to run an SQL server job

I have a job on my MSSQL server 2005, that I want to allow any database user to run. I'm not worried about security, since the input to the job's actual work comes from a database table. Just running the job, without adding records to that table will do nothing. I just can't find how to grant public permissions to the job. Is there an...

Dont know how to store session id in sql session state

I am new to ASP.NET. I am creating a website in which i have to create session for every user who gets login into the site. Now I am not been able to picturize how to store session in my database. I read few books for the same and got how to configure Session state. But i m still at the same place where i started. I am not able to get ...

SQL Server - Can you add field descriptions in CREATE TABLE?

I can see plenty of posts about where the field description extended property lives and how I can get it, but nothing about adding these at the CREATE TABLE stage. I'm dynamically creating tables so dynamically adding field descriptions would be a tidy thing to do but I cannot see a way. Has anyone managed to do this? ...

Is SQL Server changing to per core licensing?

I heard a rumor that Microsoft was going to change SQL Server 2008 R2 to per core licensing, instead of per processor/socket. Has anyone else heard this? Is there any truth to this rumor? Please cite a source if possible, especially if you believe this is changing. ...

Setting datasource on a Reporting Service report

hi all i have a drop down list contains the name of reports and each report have a value (1,2,3...) and i have a popup window that appears when user click on view report button this popup is a web page that contains the report viewer ,,in cs of this popup page i have a swtich that takes int which is the value of the report eg.if i want...

How can I view the history of inserts to a table?

Is there a way to see the history or any other information of insertions into a specific table of an SQL Server database? ...

Parsing backspace delimted text files using sqlserver 2005

I need to parse a backspace delimited flat file using sqlserver 2005 and update in some tables. What is the best way to go about it? ...

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException when using JDBC to access remote MySQL database

/** * */ package ORM; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; /** * @author Gwilym * @version 0.0 */ public class DatabaseConnection { private String userName=""; private String password=""; private String host=""; Connection conn; /** * @param userName * @param passwo...

Keeping db structure and procs in sync

I am trying to setup a test database for automated tests to run against. I know ideally we should be using mock objects, but this is an old app and doing so isn't as easy as it should be. There's simply too much logic in the database. Anyhow, enough backstory. I'm getting a clean db setup that the tests can load with known data so th...

Scripting SQL Server permissions

I want to copy all the permission I've set on stored procedures and other stuff from my development database to my production database. It's incredibly cumbersome, not to mention error prone, to do this all by hand through the SSMS GUI tool. So I'm looking for a way I can directly dump the permissions set in one database, and apply tho...

How can a sum of a column in sql server where values are 2 decimal places result in 0000000000087?

I have a table that contains a float column. There are many records in that table. When I do a Group By it shows that the float column has only the values: 0.1 0.2 0.25 0.5 1 2 3 But when I do a SUM it results in: 58.350000000000087 Where does the 0000000000087 come from? Is it because I'm using a float type instead of a decimal/num...

What SQL Server (Express) logins are needed for an ASP.NET MVC site?

For ASP.NET webforms, I have always needed the following server login: [machine_name\ASPNET]. Questions Is this requirement the same for ASP.NET MVC? If not, what do I need? Does it matter what version of SQL Server I'm using? (Currently, I'm running SQL Server Express 2005, but this could change in the future.) Does it matter what ve...

SQL: Does disabling triggers count as schema change? ("Could not complete cursor operation because the table schema changed")

Does disabling triggers count as schema change in SQL Server? I am getting error: "Could not complete cursor operation because the table schema changed" I have a stored procedure p_DeleteA that deletes a row from table A and all of its child records from table B; however, as a row in the table B gets deleted, grandchild records in table...

How Can I Order in an SQL Statement?

I have these tables: Stock, Unit, Location, Category, StockBalance At StockBalance: there is StockID from Stock, UnitId from Unit, LocationID from Location I save at StockBalance Table like following StockBalanceID | StockID | UnitID | LocationID | BalanceQuantity 1 | 1 | 1 | 1 | 20 2 ...

SQL Server get parent list

I have a table like this: id name parent_id 1 ab1 3 2 ab2 5 3 ab3 2 4 ab4 null 5 ab5 null 6 ab6 null I need to do a query with input id = 1 (for an example) and results will be like this: id name parent_id 5 ab5 null 2 ab2 5 3 ab3 2 1 ab1 3 (List all parents at all level start at item id = 1) ...

Update on Insert

Please read Update1 first! This is SSIS specific question. I have the following tasks: I need to periodically move data from table A in MySQL to Table B in MsSQL. Then all of the moved rows needs to be updated in Table A (change a single column value). I have accomplished task 1 by creating the following Data Flow: ADO NET Source ...

Linq Query slow on host but not on dev machine

I'm running ASP.NET MVC 2 Preview 2 (With VS 2010 Beta 2) using Entity Framework. Earlier yesterday, for some unknown reason, a single page in my app started to load very slowly on my host. The problem is, this only occurs on my host and I haven't changed anything for it to load slow. Here is the action that is loading very slow: pub...

ASP.NET MVC wants me to store my SQL Server database files in the App_Data folder -- should I?

When creating a new database with SQL Server Express 2005, the database files (.mdf and .ldf) get stored in C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data by default. However, with the tutorials I've seen for ASP.NET MVC (e.g., Nerd Dinner), it seems to be common practice to keep the database files in the ASP.NET project's App...