sql-server

help me generate sample data using sql script

I would like to write the SQL (MS SQL 2005/08) script to insert random large number of data in the database to test the system again heavy data. Now consider that i have sample of data like below for some columns stats [fail, pending, success, done, successful, partial_done] date [range preferably two end dates] Now can i write SQL...

dynamically populate a third dropdownlist by two independent (not cascading) dropdown lists

Hi I have two dropdown lists (one dynamically populated, the other not) that determine the values of a third dropdown list. The idea is that the first ddl1 is compulsory and ddl2 is optional. How can I get the null value (is not value is selected) of ddl2 once ddl1 value is selected. Thanks! <asp:SqlDataSource ID="SqlDataSource1" r...

SQL Server: What is the difference between CROSS JOIN and FULL OUTER JOIN?

What is the difference between CROSS JOIN and FULL OUTER JOIN in SQL Server? Are they the same, or not? Please explain. When would one use either of these? ...

SSRS 2008 - Reporting Services Webpage is Blank except for headers

I'm getting blank page when I open the Report Manager: I've got a header - "...Reporting... HOME", and then just empty space. I'm on SQL 2008 and Windows Server 2008 R2 Standard. Any ideas how to fix? I've confirmed that I am logged in as a local administrator. I tried adding the URL to trusted sites but that didn't seem to help eith...

How to port WCF/SQL app to (SQL) Azure cloud?

I've got a local app, consisting of a windows service providing the middle/business tier for a SQL Server database (c#, .net 4, SQL Server 2008 R2) Now I'd like to port this app to Windows Azure Cloud (both service and SQL database). Is somewhere a document stating the differences between a local WCF service and a windows Azure Service,...

Cross Join followed by Left Join

Is it possible to do a CROSS JOIN between 2 tables, followed by a LEFT JOIN on to a 3rd table, followed by possibly more left joins? I am using SQL Server 2000/2005. I am running the following query, which is pretty straightForward IMO, but I am getting an error. select P.PeriodID, P.PeriodQuarter, P.PeriodYear, ...

CSV Import with Validation

I have a need to import a number of CSV files into corresponding tables in SQL. I am trying to write a stored procedure that will import any of these CSV files, using a number of parameters to set things like file name, destination name etc. Simple so far. The problem comes because of the structure of this DB. Each data table has a numb...

searching data in a database

Hi, Here is the aspx.cs file for my web application: protected void Button1_Click(object sender, EventArgs e) { SqlDataReader myDataReader = null; string connectionString = "Data Source=[my source];Initial Catalog=[catalog name];Integrated Security=True"; using (SqlConnection connection = new SqlConnection(con...

SQL Express 2008 R2 Server Management Studio duplicate toolbars

I've installed SQL Express 2008 on a 64-bit Windows 7 machine and have noticed that the Server Management Studio has duplicate toolbars, so that the standard toolbar shows, "File File Edit Edit" etc. The content of the toolbars is duplicated in a similar way. Has anyone else noticed similar issues? ...

Can't set output of 'WITH XMLNAMESPACES...FOR XML PATH' to a variable?

I have a query like the following: ;WITH XMLNAMESPACES ( DEFAULT 'http://www.somewhere.com') SELECT ( 'SOMETHING' ) FOR XML PATH('RootNode'), TYPE Running this works fine. However, I run into troubles when I try to set the XML output to a variable like this: DECLARE @MYXML AS XML SELECT @MYXML = ( ;WITH XMLNAMESPACES ( DEFAULT 'http...

SQL DB2 sql error INCORRECT SYNTAX

What am I missing in this code below that will cause the error: Msg 170, level 15, line 113 line 113: Incorrect syntax near 'actual_completion_date'. update #Loss_mit_step set [STEP924_COMPL_DATE] = Case when step_code ='924' then ls_actual_completion_date else ' ' end, [STEP926_COMPL_DATE] = Case when step_code ='926' then ...

Why is MSDTC not supported when using SQL Server Mirroring & Automatic Failover?

I have an application that I would like to have support SQL Server Mirroring. However, the architecture is currently such that multiple WCF services and DB connections will be enlisted in a single MSDTC transactions, and Microsoft states that MSDTC is not supported when using Mirroring. Their explanation is not terribly informative: ...

SQL - Group By with Left Join

I have two tables. Table A has a list of employee names. Table B is a complex table with information about phone calls made by employees. My goal is to make a table with columns 'name' and 'callCount'. I am aiming to do this with a 'left join' and a 'group by', but I keep missing the employees that have made no calls. How can I just get...

SQL Server query using LIKE has problems with spaces under VBScript

[Withdrawing question: the issue arose from not escaping values submitted in web form. The ASP script removed unescaped spaces thereby causing the problem.] In a web page I am attempting to conduct a search against a table in MS SQL Server using VBScript. The search uses a LIKE clause (with wildcards). The search works fine if the input...

Merging multiple Access databases into SQL Server

We have a program in which each user is given their own Access database. We'd like to merge these all together into a single SQL Server database. The problem is that, using the SQL Server import/export wizard, the primary/foreign keys do not get updated. So for instance if one user has this table: 1 Apple 2 Banana and another us...

Have I properly commented this piece of my query?

I feel like this deserves a good comment but I get the feeling that what I have is merely a distraction. Does this deserve a comment? If so, can this comment be improved? Please note that I am working with a poorly normalized application. ( /* Remove Time Portion From ActivityDate */ DateAdd(Day, DateDiff(Day, 0, Activ...

Nhibernate cache problem while using SQL Server triggers

Hey! I am using Nhibernate with Fluent, to persist a SQL Server 2008 express database in a business application. I have a class named Receipt which contains a list with many objects named ReceiptItems. The user can create a receipt, add Receiptitems to it, and edit it as long as its not marked Finished. This part works well and saves t...

Infopath for data entry/maintenance?

I am looking for a quick way of enabling data entry to a well structured SQL database. We have defined all our data entry rules (by that I meean validation, mandatory fields etc.) and we're now looking for a tool to make it as easy as possible to have this database populated. The database is largely product orientated, so the ability t...

Row_Number() CTE Performance when using ORDER BY CASE

I have a table I'd like to do paging and ordering on and was able to get a query similar to the following to do the work (the real query is much more involved with joins and such). WITH NumberedPosts (PostID, RowNum) AS ( SELECT PostID, ROW_NUMBER() OVER (ORDER BY CASE WHEN @sortCol = 'User' THEN User END DESC, CASE ...

Update and function

I am a student, this is part of my homework. I have to Update two employee's pay by 10%...is there a function for that or do I have to calculate the figures and just change the numbers i.e. update Employee set Wage=10 where Wage=51000 This is the entire question: choose an EEO-1 Classification: Increase all employees’ salaries that ...