sql

Fluent NHibernate - automatic schema building

Okay, I have a database, but no tables in it. I have some entity classes. I'm trying to setup Fluent NH to do automappings with automatic schema export. First, this is possible, right? Second, if so, what am I doing wrong here: private ISessionFactory CreateSessionFactory() { return Fluently.Configure() .D...

mySQL inserting multiple records with a select

Hi, I have a "dictionary table" called car_status that has an 'id' column and a 'status' column. car_status id status 1 broken 2 fixed 3 working 4 fast 5 slow I have a table called cars with the columns: id, type, status_id cars id type status_id 1 jeep 1 2 ford 3 3 acura 4 ...

Why Does Adding a Fifth Argument in a MySQL "IN" Clause Dramatically Slow Things Down?

I have three tables named Item, Event, and Seat, constructed like this: Item Id (int) EventId (int) Section (int) Event Id (int) VenueId (int) Configuration (int) Home_team(int) Seat Id (int) VenueId (int) Configuration (int) Section (int) I am using the following query to select all items that are tied to particular home teams: ...

How to restore backup of msdb database

I want to take backup of jobs.I know all of these are stored in MSDB database,so i had taken a backup of the msdb database but i'm not able to restore that database as i'm getting a error while restoring on another system that the process terminated abnormally.So,what should i do to restore that. Thanks Nick Kavadias But the problem is ...

finding the posts related by tags with one specific post in mysql

I have this tables: Posts (post_is, title and text), Tags (tag_id, tag), Post_tag_nn (id, tag_id, post_id). I want for a specific post having for example 4 tags all the posts with those tags, then all the posts with any three of those tags, then all posts with any two of those tags and so on. How can i build a SQL query for this purpose ...

Looking for good sql server 2008 reference or general help

Hi Is anyone know any good reference or general help for sql server 2008 ? thank's in advance ...

MySQL: Count records from one table and then update another

Got 2 tables / entities, very straightforward scenario. Table poets - Columns: id, poet, nation Table nations - Columns: id, nation, count Basically, nations to poets has a mapping of one to many, naturally. For example, there are 1000 poets from 60 nations. Each poet in poets is assigned to a nation by the nation field which contains...

DateDiff in SQL Server asking for help

Hello everyone, I am using SQL Server 2008. I have a table which has a datetime type column called CreateTime. I need to select all the records from this table whose CreateTime is more than 3 days and half an hour from current time (UTC time). I am using T-SQL store procedure. BTW: The CreateTime column is some time in the past time. ...

how to execute a stored procedure in a SQL Agent job?

I am using SQL Server 2008 and I need to run a SQL Job from SQL Server Agent. I am new to SQL Server Job and I want to execute a stored procedure regularly from a SQL Server Job. But I did not find where to specify the executed stored procedure other than copy & paste SQL commands. Here is my screen snapshot, Any ideas how to assign ...

Any solutions to test SQL Agent Job immediately to ignore schedule

Hello everyone, I am using SQL Server 2008 and I want to test the execution correctness of my SQL Server Agent job immediately to ignore the schedule. Any ideas? thanks in advance, George ...

how to record both success and fail in SQL Server Agent Job

Hello everyone, I am using SQL Server 2008 and I am writing a SQL Server Agent Job. In my Job, there are 3 steps and in each step I will execute a store procedure. I noticed that in default Notification setting, it write information to Windows event log only when it fails. My question is, any easy solutions to write both success and fa...

SQL Server agent job account issue

Hello everyone, I am using SQL Server 2008. I am confused about which account will be used when a SQL Server agent job runs. My confusions are, SQL Server agent as a Windows Service which we could control from Windows Service Management Console, from there we could set the account to run SQL Server Agent (LocalSystem in my computer); ...

Should I read a book on specifically SQL Server, ADO, ADO.NET or ADO.NET Entities to learn to persist data for an ASP.NET MVC app?

I know the basics of mySQL and database normalization. I am getting into Microsoft programming now and plan to do a large website using ASP.NET MVC. The level of complexity of the website is probably similar to StackOverflow and other database-intensive websites. Except mine won't expect so many visitors of course :) I hear Entities is...

How to start SQL Server agent jobs automatically

Hello everyone, I am writing PowerShell scripts to control SQL Server agent start/stop to ensure all the contained jobs runs according to defined schedule. I want to make sure that the only thing I need to do is to start the SQL Server Agent Windows Service, and then all the contained SQL Server Jobs will run automatically according to ...

Create SQL Server job automatically

Hello everyone, I am writing SQL Server deployment scripts which create SQL Server job automatically on a specific SQL Server server/instance. I have found that I can extract the sql statement which can be used to create SQL Server job automatically by using script job as => Create To. My confusion is that, I find the database name and...

dynamic interval creation in SQL

I have the following problem, that I would like to solve with transact-sql. I have something like this Start | End | Item 1 | 5 | A 3 | 8 | B and I want to create something like Start |End | Item-Combination 1 | 2 | A 3 | 5 | A-B 6 | 8 | B For the Item-Combination concatenation I already thought of...

SQL select sum from other table as a column via junction table

I have 2 regular Tables "Tasks" and "Employees" and one junction table EmployeeTasks simplified they look like this Tasks TaskID ProjectID Duration Employee EmployeeID EmployeeName EmployeeTasks EmployeeID TaskID I am trying to find a tsql query that based on a common project ID would deliver a summary of the total time spen...

Problem with merge replicated database and updating via tableadapter

Hi, I'm maintaining an old application. I'd to start a merge replication between two servers. But afterwards I get these error messages "Updating columns with the rowguidcol property is not allowed." Is there really now way to use the tableadapters for updating anymore? Do I have to refactor this application in order to be able to do a...

Select top distinct results ordered by frequency

My table has two columns: id and name. The data looks like this: id | name ---------- 1 Jeff 2 Sam 3 Carl 4 Sam 5 Carl 6 Jeff 7 Dave 8 Jeff What I want to obtain is this: name | frequency ---------------- Jeff 3 Carl 2 Sam 2 Dave 1 Essentially, I need an SQL query that counts the unique ...

How do I join 4+ tables in Access with a combination inner/outer?

I have not been able to find a way to join 4 or more tables using outer join in MSAccess. It works in SQL Server, but not Access. I don't believe it is possible. I have tables A, B, C, D and E. I need to join the tables like so: A left outer join B A left outer join C A inner join D B inner join E Access won't let you use conventiona...