Search Results

Search found 37012 results on 1481 pages for 'sql query'.

Page 112/1481 | < Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >

  • Move database from sql server 2008 to 2005

    - by pencilslate
    I have a database currently in SQL Server 2008 to be moved to SQL Server 2005. I would like to backup the 2008 db to a bak file and import it to 2005, but couldn't find any options in SSMS 2008 while taking backup. Has anyone had a similar need in the past? How did you manage this through?

    Read the article

  • T-SQL: from rows to columns but not an actual pivot

    - by Matte
    Is there a T-SQL (SQL Server 2008R2) query to transform TABLE_1 into the expected resultset? TABLE_1 +----------+-------------------------+---------+------+ | IdDevice | Timestamp | M300 | M400 | +----------+-------------------------+---------+------+ | 3 | 2012-12-05 16:29:51.000 | 2357,69 | 520 | | 6 | 2012-12-05 16:29:51.000 | 1694,81 | 470 | | 1 | 2012-12-05 16:29:51.000 | 2046,33 | 111 | +----------+-------------------------+---------+------+ Expected resultset +-------------------------+---------+--------+---------+--------+---------+--------+ | Timestamp | 3_M300 | 3_M400 | 6_M300 | 6_M400 | 6_M300 | 6_M400 | +-------------------------+---------+--------+---------+--------+---------+--------+ | 2012-12-05 16:29:51.000 | 2357,69 | 520 | 1694,81 | 470 | 2046,33 | 111 | +-------------------------+---------+--------+---------+--------+---------+--------+

    Read the article

  • Why won't C# accept a (seemingly) perfectly good Sql Server CE Query?

    - by VoidKing
    By perfectly good sql query, I mean to say that, inside WebMatrix, if I execute the following query, it works to perfection: SELECT page AS location, (len(page) - len(replace(UPPER(page), UPPER('o'), ''))) / len('o') AS occurences, 'pageSettings' AS tableName FROM PageSettings WHERE page LIKE '%o%' UNION SELECT pageTitle AS location, (len(pageTitle) - len(replace(UPPER(pageTitle), UPPER('o'), ''))) / len('o') AS occurences, 'ExternalSecondaryPages' AS tableName FROM ExternalSecondaryPages WHERE pageTitle LIKE '%o%' UNION SELECT eventTitle AS location, (len(eventTitle) - len(replace(UPPER(eventTitle), UPPER('o'), ''))) / len('o') AS occurences, 'MainStreetEvents' AS tableName FROM MainStreetEvents WHERE eventTitle LIKE '%o%' Here i am using 'o' as a static search string to search upon. No problem, but not exeactly very dynamic. Now, when I write this query as a string in C# and as I think it should be (and even as I have done before) I get a server-side error indicating that the string was not in the correct format. Here is a pic of that error: And (although I am only testing the output, should I get it to quit erring), here is the actual C# (i.e., the .cshtml) page that queries the database: @{ Layout = "~/Layouts/_secondaryMainLayout.cshtml"; var db = Database.Open("Content"); string searchText = Request.Unvalidated["searchText"]; string selectQueryString = "SELECT page AS location, (len(page) - len(replace(UPPER(page), UPPER(@0), ''))) / len(@0) AS occurences, 'pageSettings' AS tableName FROM PageSettings WHERE page LIKE '%' + @0 + '%' "; selectQueryString += "UNION "; selectQueryString += "SELECT pageTitle AS location, (len(pageTitle) - len(replace(UPPER(pageTitle), UPPER(@0), ''))) / len(@0) AS occurences, 'ExternalSecondaryPages' AS tableName FROM ExternalSecondaryPages WHERE pageTitle LIKE '%' + @0 + '%' "; selectQueryString += "UNION "; selectQueryString += "SELECT eventTitle AS location, (len(eventTitle) - len(replace(UPPER(eventTitle), UPPER(@0), ''))) / len(@0) AS occurences, 'MainStreetEvents' AS tableName FROM MainStreetEvents WHERE eventTitle LIKE '%' + @0 + '%'"; @:beginning <br/> foreach (var row in db.Query(selectQueryString, searchText)) { @:entry @:@row.location &nbsp; @:@row.occurences &nbsp; @:@row.tableName <br/> } } Since it is erring on the foreach (var row in db.Query(selectQueryString, searchText)) line, that heavily suggests that something is wrong with my query, however, everything seems right to me about the syntax here and it even executes to perfection if I query the database (mind you, un-parameterized) directly. Logically, I would assume that I have erred somewhere with the syntax involved in parameterizing this query, however, my double and triple checking (as well as, my past experience at doing this) insists that everything looks fine here. Have I messed up the syntax involved with parameterizing this query, or is something else at play here that I am overlooking? I know I can tell you, for sure, as it has been previously tested, that the value I am getting from the query string is, indeed, what I would expect it to be, but as there really isn't much else on the .cshtml page yet, that is about all I can tell you.

    Read the article

  • SQLInForm.com like plug-in for SQL Server 2008

    - by Vishal Seth
    Is there a plug-in like the java applet @ SQLinForm.com for MS SQL Server Management Studio 2008? I tried SSMS tools based on someone's answer to my previous question but I don't find any functionality to format (beautify/tabify) SQL. If somebody could please point out that in SSMS tools or suggest some other tool (preferably free) Thanks :)

    Read the article

  • Sql compression and backing up in sql server 2005

    - by cagin
    Hi there I want to backup my database with compression. This is my code : BACKUP DATABASE dbbbb TO DISK = N'C:\\dbbb.bak' WITH COMPRESSION this running correctly in Sql Server 2008. But my server has Sql Server 2005 and COMPRESSION is not a recognized BACKUP option in 2005. How can i compress my backup in 2005 Thank you for your helps.

    Read the article

  • 32bit to 64bit sql server 2008 database conversion

    - by Eric
    We are in the process of moving databases from older 32 bit hardware running sql 2005 to newer hardware with sql 2008 64 bit. My question is if the database is automatically converted to 64bit after it is reattached on the new server or if it is running in 32bit mode on a 64bit instance. Is there a way to tell?

    Read the article

  • SQL select maximum from two time periods

    - by HamishC
    I have a query, Im trying to select the maximum value from the summer period (nov-april down here) but it only gives me values from nov-dec with this query. Any ideas why? SELECT TOP 10 Value, DateTime FROM history WHERE Tagname = @Tag AND ((DateTime >= @StartYear AND DateTime < @StartWinter) OR (DateTime >= @FinishWinter AND DateTime < @FinishYear)) ORDER BY Value DESC

    Read the article

  • File transfer through MS SQL connection

    - by wasim
    I have a text file sitting on client machine and want to move it to the database server (MS SQL 2008) but I don't have any access to the server except MSSQL client. Can I transfer this file to the server using SQL client connection?

    Read the article

  • Using ROWLOCK in an INSERT statement (SQL Server)

    - by RPS
    Would it be wise to use ROWLOCK on an insert statement that is copying large amounts of data and inserting it into the same table? Ex) INSERT INTO TABLE with (rowlock) (id, name) SELECT newid, name FROM TABLE with (nolock) WHERE id = 1 Does anybody have recommendations on how to improve this statement, as I see when SQL Server gets busy it will end in Timeout Query returned for SQL Server.

    Read the article

  • Finding a Identity Specification using SQL

    - by J Harley
    Good Morning, I have an MS SQL database, of which there is a column that has an identity specification. However, if I do a SQL query such as: SELECT * FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = It doesn't tell me if the column is an identity specification - is there a query that will? Many Thanks, Joel

    Read the article

  • Why was this T-SQL Syntax never implemented?

    - by ChrisA
    Why did they never let us do this sort of thing: Create Proc RunParameterisedSelect @tableName varchar(100), @columnName varchar(100), @value varchar(100) as select * from @tableName where @columnName = @value You can use @value as a parameter, obviously, and you can achieve the whole thing with dynamic SQL, but creating it is invariably a pain. So why didn't they make it part of the language in some way, rather than forcing you to EXEC(@sql)?

    Read the article

  • Auto-complete editor for SQL statement

    - by Stan
    Is there any plugings or text editor to auto-complete SQL statement? I am using SQL Server Management Studio (ssms) 90% of time, but most of time I have to type SELECT FROM WITH(NOLOCK) WHERE blahblah. Trying to find a more efficient way. Thanks.

    Read the article

  • Expanding list of databases in SQL Server 2008 Management Studio Takes Longer than SQL Server 2005

    - by Clever Human
    Is it just me, or does expanding the list of databases in SQL Server 2008 Management Studio take significantly more time than expanding the list of databases in SQL Server 2005 Management Studio? If it isn't just me, is there an explanation for this behavior? Whatever it is doing in the background that makes it take longer, can we turn that off? Is it configurable? I know, it seems trivial, but I am perpetually being surprised at how long this takes.

    Read the article

  • Limiting the number of queries returns in SQL Server 2008

    - by Jose Sotero Villegas III
    This is my query SELECT Fullname, rank, id_no, TIN, birthdate, hair, eyes, Blood, height, weight, marks, name, address FROM [******_DOMAIN\****_*****].*******view Problem is, source table has too many duplicates, how do I my limit query to the latest row on the database? I'm using SQL Server 2008. Thanks In advance My next problem is that the view shows me a birthdate string format of yyyymmdd, I need to change it to mm/dd/yyyy can please provide me a function? using the same string above?

    Read the article

  • SQl Server error handling pattern

    - by Patrick Honorez
    Hi all. I am not an expert on SQl Server. Is this a valid pattern for handling errors in a batch of SELECT, INSERT...in SQl SERVER ? (I use v.2008) BEGIN TRANSACTION BEGIN TRY -- statement 1 -- statement 2 -- statement 3 COMMIT TRANSACTION END TRY BEGIN CATCH ROLLBACK TRANSACTION END CATCH Thanks

    Read the article

  • Convert this SQL statement to LINQ-to-SQL

    - by goforebroke
    I have struggled converting this SQL statement to LINQ to SQL VB.Net 9.0. I have used Linqer but no success. Any help would be appreciated select t.TeeId, t.DescriptionId, t.[Description], t.Rating, t.Slope, case when d.TotalHoles <> h.TotalHoles then 0 else 1 end [Status] from dbo.CourseDescription d inner join dbo.CourseTees t on t.DescriptionId = d.DescriptionId inner join (select TeeId, count(*) as TotalHoles from dbo.CourseHoles group by TeeId) h on h.TeeId = t.TeeId where d.CourseId = 1

    Read the article

  • SQL Select for multiple where clause

    - by Tony
    Hi, I am trying to create SQL Select that returns counts of a certain field based on a field. So, here is what I am trying to do. Select count(distinct id) as TotalCount, -- this will be the total of id count(distinct id where type='A') as TotalA, -- this will be total when type='A' count(distinct id where type='B') as TotalB -- This will be total when type = 'B' from MyTable Basically, TotalCount = TotalA + TotalB. How can I achieve this in SQL Select Statement? Thanks.

    Read the article

< Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >