Search Results

Search found 2495 results on 100 pages for 'mssql maintenance'.

Page 17/100 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • MSSQL add count column near existing select columns

    - by Luis
    Hi, i have a query that returns something like this. ID | Company| Total_Money | no_items | count_Total_Money_For_Company ----------------------------------------------------------- 1 | A | 1000 | 1 | 2001 2 | A | 1001 | 0 | 2001 3 | B | 1001 | 1 | 5010 4 | B | 1002 | 1 | 5010 5 | B | 1003 | 1 | 5010 6 | B | 1004 | 1 | 5010 7 | B | 1000 | 1 | 5010 How can i add that column with the count for that company?

    Read the article

  • How to convert a MSSQL database (including procedures, functions and triggers) to a firebird databas

    - by user193655
    I am considering migrating to Firebird. To have a "quick start" approach I downloaded the trial of a conversion tool (DBConvert) and tried it. I just picked up a random tool, this tool doesn't convert procedures, functions and triggers (I don't think it is a limit of the trial since there is not an explicit reference to sp, sf and triggers in the link above). Anyway by trying that tool I had the message: "The DB cannot be converted succesfully because some FK names are too long." This is because in some tables I have FK whose description is 32 chars. Is this a real firebird limit or it is possible to overcome it somehow (of course renaming the FK is an extreme option because it is extra work)? Anyway how to convert a MS SQL DB fully to FIREBIRD? Is there a valid tool? Did someone succed in a conversion of non trivial databases?

    Read the article

  • MSSQL - select date field in table

    - by thegunner
    Hi, In my table I have a date column which the date is displayed in the format "2009-11-18 10:55:28.370" How can just get the date value of this field in a select statement. e.g. select id from risks, where creation_date = getdate()

    Read the article

  • MSSQL - Select one random record not showing duplicates

    - by Lukes123
    I have two tables, events and photos, which relate together via the 'Event_ID' column. I wish to select ONE random photo from each event and display them. How can I do this? I have the following which displays all the photos which are associated. How can I limit it to one per event? SELECT Photos.Photo_Id, Photos.Photo_Path, Photos.Event_Id, Events.Event_Title, Events.Event_StartDate, Events.Event_EndDate FROM Photos, Events WHERE Photos.Event_Id = Events.Event_Id AND Events.Event_EndDate < GETDATE() AND Events.Event_EndDate IS NOT NULL AND Events.Event_StartDate IS NOT NULL ORDER BY NEWID() Thanks Luke Stratton

    Read the article

  • change string in mssql to abbreviate

    - by jeff
    How do I return the everything in a string from a sql query before a certain character? My data looks like this: HD TV HM45VM - HDTV widescreen television set with 45" lcd I want to limit or truncate the string to include everything before the dash. So the final result would be "HD TV HM45VM"

    Read the article

  • MSSQL using SSH-tunnel from Visual Studio

    - by pbt
    Hi, I recently contacted a web host regarding support for external database access to a Microsoft SQL Database included in a package they offer. They replied saying that it is only possible with an SSH-tunnel. Is it possible to connect to a MS SQL database in Visual Studio using an SSH-tunnel? It is important for me to be able to access the database from my local machine (for debugging, generating LINQ classes, editing tables, etc). Or, how should I go about working with their database?

    Read the article

  • Migrating from mssql to firebird: pro and cons

    - by user193655
    i am considering the migration for 3 reasons: 1) SQLSERVER installation is a nightmar, expecially for 1-user software. Software installs in 10 seconds, SQLServer in 1 hour. Firebird installation is much easier. 2) SQLSERVER runs on windows server only 3) My customers have all the express edition 4) i am not using any advanced feature, I am now starting using filestream, but the main reason for this is that Express eidtion has 4/10GB db size limit So these are all Pros of moving to Firebird. Which are the cons? I can also plan to support both platiforms, but this will backfire I fear.

    Read the article

  • Fully automated MS SQL Restore

    - by hasen j
    I'm not very fluent with MS-SQL commands. I need a script to restore a database from a .bak file and move the logical_data and logical_log files to a specific path. I can do: restore filelistonly from disk='D:\backups\my_backup.bak' This will give me a result set with a column LogicalName, next I need to use the logical names from the result set in the restore command: restore database my_db_name from disk='d:\backups\my_backups.bak' with file=1, move 'logical_data_file' to 'd:\data\mydb.mdf', move 'logical_log_file' to 'd:\data\mylog.ldf' How do I capture the logical names from the first result set into variables that can be supplied to the "move" command? I think the solution might be trivial, but I'm pretty new to mssql.

    Read the article

  • how to connect to MSSQL using activerecord, JDBC, JTDS and Integrated Security

    - by Rob
    As per the above, I've tried: establish_connection(:adapter => "jdbcmssql", :url => "jdbc:jtds:sqlserver://myserver:1433/mydatabase;domain='mynetwork';", :username => 'user', :password=>'pass' ) establish_connection(:adapter => "jdbcmssql", :url => 'jdbc:jtds:sqlserver://myserver:1433/mydatabase;domain="mynetwork";user="mynetwork\user"' ) establish_connection(:adapter => "jdbcmssql", :url => "jdbc:jtds:sqlserver://myserver:1433/mydatabase;domain='mynetwork';", :username=>'user' ) establish_connection(:adapter => "jdbcmssql", :url => "jdbc:jtds:sqlserver://myserver:1433/mydatabase;domain='mynetwork';integratedSecurity='true'", :username=>'user' ) .. and various other combinations. Each time I get: net/sourceforge/jtds/jdbc/SQLDiagnostic.java:368:in `addDiagnostic': java.sql.SQLException: Login failed for user ''. The user is not associated with a trusted SQL Server connection. (NativeException) Any tips? Thanks, activerecord (2.3.5) activerecord-jdbc-adapter (0.9.6) activerecord-jdbcmssql-adapter (0.9.6) jdbc-jtds (1.2.5) jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java HotSpot(TM) Client VM 1.6.0_18) [x86-java]

    Read the article

  • Create Mssql database from c# - using Parameters

    - by Alon M
    i am trying to put up a code to create a databases from my c# code (asp.net website). this is my code - SqlCommand myCommand = new SqlCommand("CREATE DATABASE @dbname", nn); myCommand.Parameters.Add("dbname", dbname); myCommand.ExecuteNonQuery(); nn.Close(); well, its not working. its giveing me an error - this one : incoreect syntex near '@dbname'. BUT. if i wont use parameters, peolpe can sql inj to my database. do you have any idea how can use anything, to get the database name from a textbox. and that peolpe cant sql inj me db?

    Read the article

  • MSSQL 2008 - Bit Param Evaluation alters Execution Plan

    - by Nathanial Woolls
    I have been working on migrating some of our data from Microsoft SQL Server 2000 to 2008. Among the usual hiccups and whatnot, I’ve run across something strange. Linked below is a SQL query that returns very quickly under 2000, but takes 20 minutes under 2008. I have read quite a bit on upgrading SQL server and went down the usual paths of checking indexes, statistics, etc. before coming to the conclusion that the following statement, found in the WHERE clause, causes the execution plan for the steps that follow this statement to change dramatically: And ( @bOnlyUnmatched = 0 -- offending line Or Not Exists( The SQL statements and execution plans are linked below. A coworker was able to rewrite a portion of the WHERE clause using a CASE statement, which seems to “trick” the optimizer into using a better execution plan. The version with the CASE statement is also contained in the linked archive. I’d like to see if someone has an explanation as to why this is happening and if there may be a more elegant solution than using a CASE statement. While we can work around this specific issue, I’d like to have a broader understanding of what is happening to ensure the rest of the migration is as painless as possible. Zip file with SQL statements and XML execution plans Thanks in advance!

    Read the article

  • MSSQL Sum query

    - by ldb
    today my problem is this i have 2 column and i wish check if the sum of that columns isn't Higher then a value(485 for example) and if is do a query...i though to do SELECT * FROM table WHERE ColumnA+ColumnB<485 But isn't working... i've already tried with SELECT Sum(ColumnA)+Sum(ColumnB) AS Total FROM table but it gives me 1 column with the sum of all rows, i instead want a row for every sum. so how can i do..? xD i hope you understood if not just ask that i try to explain it better! and thanks in advice for who want to help me! EDIT: I Found out XD the problem was that the columns was Smallint and the result of 1 or more rows was more than 32k so it wasn't working! Thanks At all!!

    Read the article

  • Eclipse Debug Mode disrupting MSSQL Server 2005 Stored Procedure access

    - by Sathish
    We have a strange problem in our team. When a developer is using Eclipse in Debug mode, MS SQL Server 2005 blocks other developers from accessing a stored procedure. Debug session typically involves opening Hibernate session to persist an entity which could be accessing a stored procedure used for Primary key generation. Debugging is done in business logic code and rarely in JDBC stored procedure call. Is there any way to configure MS SQL server or the stored procedure so that other developers are not blocked?

    Read the article

  • Get top 'n' records by report_id

    - by Skudd
    I have a simple view in my MSSQL database. It consists of the following fields: report_id INT ym VARCHAR -- YYYY-MM keyword VARCHAR(MAX) visits INT I can easily get the top 10 keyword hits with the following query: SELECT TOP 10 * FROM top_keywords WHERE ym BETWEEN '2010-05' AND '2010-05' ORDER BY visits DESC Now where it gets tricky is where I have to get the top 10 records for each report_id in the given date range (ym BETWEEN @start_date AND @end_date). How would I go about getting the top 10 for each report_id? I've stumbled across suggestions involving the use of ROW_NUMBER() and RANK(), but have been vastly unsuccessful in their implementation.

    Read the article

  • SQL tables using VARCHAR with UTF8 (with respect to multi byte character length)

    - by Elius
    Like in Oracle VARCHAR( 60 CHAR ) I would like to specify a varchar field with variable length depending on the inserted characters. for example: create table X (text varchar(3)) insert into X (text) VALUES ('äöü') Should be possible (with UTF8 as the default charset of the database). On DB2 I got this Error: DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001 (Character data, right truncation occurred; for example, an update or insert value is a string that is too long for the column, or a datetime value cannot be assigned to a host variable, because it is too small.) I'm looking for solutions for DB2, MsSql, MySql, Hypersonic.

    Read the article

  • MSSQL + Copy data from one server database table to the other

    - by lucky
    Hello All, I dont know how to copy table data from one server - database - table TO other sever - database - table. If it is with in the same server and different databases, i have used the following SELECT * INTO DB1..TBL1 FROM DB2..TBL1 (to copy with table structure and data) INSERT INTO DB1..TBL1(F1, F2) SELECT F1, F2 FROM DB2..TBL1 (copy only data) Now my question is copy the data from SERVER1 -- DB1-- TBL1 to SERVER2 -- DB2 --TBL2 Thanks in advance!

    Read the article

  • How to efficiently use LOCK_ESCALATION mssql 2008

    - by Avias
    I'm currently having troubles with frequent deadlocks with a specific user table in MS SQL 2008. Here are some facts about this particular table: Has a large amount of rows (1 to 2 million) All the indexes used on this table only has "use row lock" ticked on its option rows are frequently updated by multiple transactions but are unique (e.g. probably a thousand or more update statements are executed to different unique rows every hour) the table does not use partitions. Upon checking the table on sys.tables, I found that the lock_escalation is set to TABLE I'm very tempted to turn the lock_escalation for this table to DISABLE but I'm not really sure what side effect this would incur. From What I understand, using DISABLE will minimize escalating locks to TABLE level which if combined with the row lock settings of the indexes should theoretically minimize the deadlocks I am encountering.. From what I have read in Determining threshold for lock escalation it seems that locking automatically escalates when a single transaction fetches 5000 rows.. What does a single transaction mean in this sense? A single session/connection getting 5000 rows thru individual update/select statements? Or is it a single sql update/select statement that fetches 5000 or more rows? Any insight is appreciated, btw, n00b DBA here Thanks

    Read the article

  • Centralizing / Abstracting MSSQL Data from Multiple Tables / Databases

    - by davemackey
    If one has a number of databases (due to separate application front-ends) that provide a complete picture - for example a CRM, accounting, and product database - what methods are available to centralize/abstract this data for easy reporting? Essentially, I'm wondering if there is a way to automatically pull data from multiple databases into a central repository that is continuously updated from the three databases and which can be used for reporting? I'm also open to alternative best practice suggestions?

    Read the article

  • Hibernate and mssql inner join rowcount

    - by ez2sarang
    I am struggling with Hibernate Criteria. My aim is to create the following request using Hibernate Criteria : select count(*) as y0_ from PInterface this_ inner join Product product2_ on this_.product_id=product2_.id where this_.product_interface_type_id=? Here is my code: @Entity @Table(name = "PInterface") public class PInterface { @Id @GeneratedValue @Column(name = "id", nullable = false, insertable = false, updatable = false) private int id; @Column(name = "product_id") private int productId; @Column(name = "product_interface_type_id") private int type; @ManyToOne(optional=false) @JoinColumn(name = "product_id", referencedColumnName = "id", insertable=false, updatable=false) private Product product; } @Entity @Table(name = "Product") public class Product { @Id @GeneratedValue @Column(name = "id", nullable = false, insertable = false, updatable = false) private int id; private String name; } //Criteria is : Object criteria = sessionFactory.getCurrentSession() .createCriteria(PInterface.class) .add(Restrictions.eq("type", 1)) .setProjection(Projections.rowCount()) .uniqueResult() ; However, the results ... select count(*) as y0_ from PInterface this_ where this_.product_interface_type_id=? Where Inner join? Thank you for help!

    Read the article

  • TSQL - MSSQL 2008 add a column and update it in same stored procedure

    - by TortTupper
    if I have a stored procedure say create procure w AS ALTER TABLE t ADD x char(1) UPDATE t set x =1 Even when it lets me create that stored procedure (if I create it when x exists), when it runs, there is an error on the UPDATE statement because column x doesn't exist. What's the conventional way to deal with this, it must come up all the time? I can work around it by putting the UPDATE inside EXEC, is there another/better way? Thanks

    Read the article

  • Unit test with live data

    - by Kurresmack
    Hey, I have googled this a little and didn't really find the answer I needed. I am working on a webpage in C# with MSSQL and LINQ for a customer. I want the users to be able to send messages to each other. So what I do is that I unit test this with live data. The problem is that I now depend on having at least 2 users who I know the ID of. Furthermore I have to clean up after my self. This leads to rather large unit tests that test alot in one test. Lets say I would like to update a user. That would mean that I would have to ceate the user, update it, and then delete it. This a lot of assertions in one unit test and if it fails with updating i have to manually delete it. If I would do it any other way, without live data, I would not fore sure be able to know that the data was present in the database after updating etc. What is the proper way to do this without having a test that tests a lot of functuality by it self?

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >