sql-server-2008

Adding values in a table in SQL 2008

Hi all, Trying to get a basic understanding of T-SQL here in SQL Server 2008. Suppose I have a table named "Issues" with columns such as: Priority User 1 Foo 1 Foo 2 Foo 5 Foo 4 Bar 5 Bar 1 Bar 1 Fuz and I wish to display a count of the Priority for each User, along with a break...

What is the usage of policy management in sql server 2008?

What is the usage of policy management in management part of sql server 2008?? ...

Custom Logging within sql server 2008 Scheduler Job > View Histroy?

I am creating sql server 2008 Agent scheduler job form sql script. Want to Log the details if failed in some case within Job > View Histroy. Is there any way, so we can log custom text with Job > View Histroy? ...

How to combined first_name and last_name using sql query?

There are two columns in database as name FIRST_NAME and LAST_NAME.i want to join both the name and display in single column. The query which is used by me is given below but it gives error as Incorrect syntax near 'NAME'. Modify the query: SELECT [CREATED_ON], MUD.PK_ID AS USER_ID, (MUD.FIRST_NAME + ' ' + MUD.LAST_NAME NAME) AS NAME...

SQL Server Error 223 When Connecting

Hi guys, I recently changed SQL Server 2008 from windows authentication mode, to mixed. I created a new user 'taraw' and set a password. I'm connecting to localhost - which works perfect when using windows authentication, however if I want to use SQL Server authentication with my user - taraw, I get the following error: Shared Memor...

ODBC: SQL Server 2008 Driver for MS Access

I usually make applications with the front end in Access 2003 - 2007 and the back-end on SQL Server 2008. When I create an ODBC to link the tables in access I have two choices in the ODBC Data Source Administration page on my Windows XP PC: Server 2008: SQL Server Native Client 10.0 v.2007.100.2531.00 SQL Server v. 2000.85.1132.00 W...

Cannot open database, Login failed for user

Hi guys, I'm running the nerddinner MVC application on visual studio, and the database is on sql server 2008. I was previously having problems with permissions, etc but I seemed to have these sorted. I created a user - taraw in SQL Server Management Studio, and got this all working. I can log into it fine. When I test the application...

Prevent inserting overlapping date ranges using a SQL trigger

I have a table that simplified looks like this: create table Test ( ValidFrom date not null, ValidTo date not null, check (ValidTo > ValidFrom) ) I would like to write a trigger that prevents inserting values that overlap an existing date range. I've written a trigger that looks like this: create trigger Trigger_Test on Test for i...

Turn off implicit transactions

Hello everyone, I would like to do a insert into using a select, but I know that some rows might fail (that is expected). Is there a way to change the implicit transactions of SQL Server 2008 off so that the ones that have not failed are not rolled back? -- get the count of the customers to send the sms to SELECT @count = COUNT(*) FROM ...

LINQ to SQL SubmitChanges not working FILESTREAM Table

I have some code that inserts data into some tables (one table has a FILESTREAM column) and then calls SubmitChanges after it is done. db.Log = new System.IO.StreamWriter(@"c:\windows\temp\linq.log") { AutoFlush = true }; db.SubmitChanges(ConflictMode.FailOnFirstConflict); I have referenced the following links but they appear to not b...

SQL Query Assistance

Hi all, I'm having a complete brain fart moment so i figured i'd ask away here. I have 3 tables that look like this Equipment Table EquipmentID | LocationID ------------------------- 1 | 2 2 | 2 3 | 1 4 | 2 5 | 3 6 | 3 Location Table LocationID | LocationName ------------...

Select records with a substring from another table

Hi, I have this two tables: data id |email _ 1 |[email protected] 2 |[email protected] 3 |zzzgimail.com errors _ error |correct @gmial.com|@gmail.com gimail.com|@gmail.com How can I select from data all the records with an email error? Thanks. ...

SQL Server 2008: copying the contents of all tables from one database into another database

I have two databases with THE SAME schema. I need to copy the contents of all the tables from one database into the other database. What is the best way to do this>? There are about 200 tables. I have ssms. ...

How to select 12 rows of a given result set for use in DataGrid/Paging? Need to override Grid default caching.

I have a SQL query that will return over 10,000 rows. Since the client only will view 12 rows at a time, how do I alter my SQL so that I can select just the needed rows? My expectation is that I'll requery the database each time the user clicks on the grid. My solution is based on the demo below, however I'm trying to make this work w...

Return SQL Query as Array in Powershell

I have a SQL 2008 Ent server with the databases "DBOne", "DBTwo", "DBThree" on the server DEVSQLSRV. Here is my Powershell script: $DBNameList = (Invoke-SQLCmd -query "select Name from sysdatabases" -Server DEVSQLSRV) This produces my desired list of database names as: Name ----- DBOne DBTwo DBThree I has been my assumption that a...

Does SQL Server 2008 have "stock" table parameter types?

Does SQL Server 2008 offer any pre-defined table types for use with table-valued parameters? For instance, if I just want to pass in a list of integers as a table, and derive necessary context from the other parameters I'm passing in, is there a type in place for that, or would I have to create it? ...

SQL Server 2008 Mirrored DB Update Rollback - Crisis

Hi SO, I am a programmer who has done a very bad thing and somehow didn't select the WHERE clause before hitting F5 on an update query in SQL Server 2008. I know this isn't a programming question but it is a question from a desprate programmer ... Is there anyway to get the one column's data back from the transaction log or a log kept ...

Create Index on partial CHAR Column

I have a CHAR(250) column being used as a foreign key to a varchar(24) column. In MySQL I recall that I could create an index specifying column(24) in order to create an index on the leftmost 24 characters. This doesn't appear to be possible on MS SQL Server. My question is this: Is it possible to use an indexed view on SQL Server 20...

SQL Server 2008, developer edition.

Where is the SQL Analyzer? I did a full install, I don't see it anywhere in the menus. If for some reason is just doesn't exist any more, what are some viable alternatives? ...

listview with imagebutton thumbnails in asp.net

I am trying to implement an image gallery in ASP.NET./c# I am displaying 6 thumbnails on my page. To display this I have decided to use ListView with an ItemTemplate containing an ImageButton control in it for each thumbnail that I would be displaying. I have a few questions: Am I choosing the right controls? (there are options like D...