Posts by jean • 904 points
39 posts
- 
		1 votes2 answers69 viewsA: Match table data on Linkedserver serversYou can make an insert straight from a select of course but pq do this if vc have a free tool to make data comparison from MS SQL Server? Any version of Visual Studio has a tool for data comparison… 
- 
		0 votes1 answer167 viewsA: Deleting using subquery and JoinIn general you can do DELETE and UPDATE using joins with no problem. Usually I do like you, make first one SELECT returning all records I want to delete: Select distinct p.EVENT_ITEM_ID From… 
- 
		0 votes1 answer30 viewsA: How can I remove the spacing between methods and properties?See the image below: Usually these "gaps" between the lines are "helpers" that the editor shows, things that he wants to show but that are not really written in the code. Check its properties and… 
- 
		0 votes3 answers658 viewsA: Compare 2 field-to-field tablesYou did not specify how the result should be shown so I am proposing two options: Using these records as an example: create table contatonovo ( codigo varchar(5) null ,nome varchar(50) null ,celular… 
- 
		0 votes4 answers91 viewsA: Select with columns stating incorrect dataMaybe the problem is in this query snippet: FROM empresas j, informessocios i It seems that you are mixed explicit joins with implicit ones. Also never use fields like "name" or "code" as joins keys… 
- 
		1 votes1 answer395 viewsA: Consider NULL as 0Use COALESCE. This SQL function takes a list of n parameters and returns the first non-null value it finds. Below follows a small example: create table tabela_exemplo ( descricao varchar(20) not… 
- 
		2 votes1 answer974 viewsA: SQL SERVER myth about SELECT INTO and tempdb locksTEMPDB It is a system database and every time you use temporary tables (#Mytemptableexample) they are created in this database (not with this name but pq several sessions may be using the same name,… 
- 
		1 votes2 answers1061 viewsA: What are real and practical examples in the use of Stored Procedures?Two examples: Two applications a web service made in C# and a desktop application made in Delphi need to run a business rule implemented in BD. For better maintenance and management it is better… 
- 
		0 votes2 answers229 viewsA: Dynamic SQL result sortingIf you really want to go this way you can just cast (to sweep), so you would get around the problem of columns being of different types. But note that using a clause CASE within a clause ORDER BY is… 
- 
		1 votes2 answers184 viewsA: How to interrupt the database query using time out in Hibernate?It’s been a while since I did this with nhibernate. Look for references to connection properties on Hibernate. In the same file/code where you set the connection you can set the timeout. below some… 
- 
		0 votes3 answers2032 viewsA: Select from the last records sorted by 1 fieldAs the bfavaretto commented you should already be using the best option for your requirements. Note you want to: The last three records. Displays them sorted by name. For the first requirement you… 
- 
		2 votes2 answers511 viewsA: Filters or Sort, which should be the first when creating an index in the databaseIndex creation order does not change the use of the index. As for leaving an index covering several columns I suggest you create two, one for the filters and the other for sorting because the DBMS… 
- 
		4 votes1 answer983 viewsA: How to measure time complexity of sorting algorithms?You’re trying to make a correlation between theory and practice and as we know in theory both are equal, in practice no. Theory: Using O() notation you study the behavior of the algorithm, i.e. how… 
- 
		3 votes3 answers906 viewsA: Can a primary key be used on a foreign key?1) The only restriction for foreign keys is that they should point to a single key. Note that all PK, by definition, is a single key. Think about it: the foreign key indicates who is the parent… 
- 
		1 votes4 answers860 viewsA: Select with indefinite amount of conditionsIt depends on the complexity of the functionality you want to implement and the size of your application. For a small and simple application you can fix up to three fields, require at least the… 
- 
		4 votes3 answers2122 viewsA: Is it possible to create a Javascript database?Short answer: No! Elaborating a little more: Depends of your needs. A DBMS is a powerful tool to persist your data. Therefore the name DATABASE, your data is saved and protected and when you need… 
- 
		5 votes2 answers577 viewsA: Is it good practice to keep foreign key columns redundant?You didn’t ask for personal opinion, asked if it was good practice. In addition Stackoverflow does not propose to answer questions based on personal opinion and recommends that no questions of this… 
- 
		3 votes4 answers818 viewsA: Database being changed/HackedThis really looks like SQL Injection Attack. The problem per se not get but dynamic SQL, which mounts the script on the fly. Sanitizing data helps but there are hacker techniques of quoting using… 
- 
		1 votes2 answers508 viewsA: When is it recommended to use decreasing indexes?Depends on your need. By default the indexes are created in ascending order because, in general, the values (usually ids) are generated increasing. This way the new (larger) values go to the end of… 
- 
		1 votes3 answers2325 viewsA: Order By - Leave specific record for firstI prefer an alternative where I don’t need to create a dynamic order by select Store_Name, Sales, Date, case when store_name = 'Boston' then 0 else 9 end as Orderby from tabela order by orderby… 
- 
		2 votes4 answers1022 viewsA: How to keep column 'order' in sequence even after editing the order of records?I understand you’re dragging names from one position to another. In this case you would only need a pair (Id, Order)Origin and (Id, Order)Destination. Following his example: id order name 1 1 Fabio… 
- 
		1 votes4 answers2357 viewsA: Good practices for storing logsIt depends a little on the technology you are using but @guerra is right. Because Trigger makes maintenance difficult and you will have to implement Trigger in n tables. It is not practical if you… 
- 
		2 votes2 answers6990 viewsA: CASE error in ORACLE’s WHEREYou don’t need CASE for this, just use common boolean logic. AND( (t1.cd1 IS NOT NULL AND t2.cd1 = t1.cd1) OR (t3.cd2 = t1.cd2) ) BTW, yes! you can do something like: where column_1 =… 
- 
		0 votes2 answers2883 views
- 
		0 votes1 answer423 viewsA: Error creating SQL Server 2005 database with compressed diskIn addition to not being considered a good practice (IO of disks can be intense in a database, requiring compression/decompression all the time) the SSMS is not willing to create that . MDF unless… 
- 
		3 votes6 answers14419 viewsA: Which database should I use in a small desktop application?You said you store sensitive data in excel? For sensitive data and C# I would prefer to use MS Sql. For not so important data you can use any one. "smaller" bases (surely its base is small) can use… 
- 
		1 votes3 answers491 viewsA: Logica de Distribuição IgualadaI don’t know any formal solution but if I were to "invent" one I would do the following. Use a counter for your list of variables. Looping the list, inserting each variable in the sequence and… 
- 
		0 votes3 answers1494 viewsA: Filter table before applying a LEFT JOINAs a general rule you only leave in Join what is necessary for the tables to be compared to each other, in your case only c.Client = and.Client. And you leave in the Where only what is the filter,… 
- 
		0 votes2 answers1395 viewsA: Problem using 'Google Fonts'Have you tried the Icomoon? It has great features for editing and downloading files from sources. I use primarily to create icons as fonts but I believe it can be used as fonts to write texts (well,… 
- 
		3 votes5 answers462 viewsA: Internet Explorer, should I still be worried about him?Yes! But it depends on the version. See this chart that I built on Statcounter (Using by version last year): http://gs.statcounter.com/#browser_version_partially_combined-BR-Monthly-201301-201401… 
- 
		9 votes8 answers59138 viewsA: How to raise a number to a power without using the Math. h library?Welcome to the world of computational mathematics where various functions such as Pi, square root, sine and cosene are implemented as the summations of infinite convergent series. There’s a similar… 
- 
		0 votes2 answers4039 viewsA: Why use Bytes instead of Image? What is the best practice?Another solution is not to store blobs in the database in any way. This is especially good for performance when you upload/donwload large files. From experience I have seen that it is much more… 
- 
		2 votes4 answers2553 viewsA: Database structure for multi-language systemTo make a multi language system you will have to refactor it virtually all. Adding an extra column per language as you intend is not considered a good practice (it is a gambiarra). Ideally you would… 
- 
		-2 votes7 answers2949 viewsA: How to use multiple SQL commands (in the case delete on ORACLE) in one line only on C#?Use the boolean OR on your Where comand.CommandText = "DELETE FROM TB_CR_INDICADOR WHERE COD_INDICADOR = " + codigo + "; DELETE FROM TB_CR_INDICADOR_PERIODO WHERE COD_INDICADOR = " + codigo + ";… 
- 
		3 votes8 answers7830 viewsA: Is giving a "SELECT" before an "INSERT" a safe way of not having duplicate records?Without changing the base just by changing the dynamic query would be something +- like this: begin tran with isolation level read commited update table where id = @iD if (@@rowcount = 0) -- se não… 
- 
		4 votes1 answer1046 viewsA: What is the best way to make an online database backupThe problem is bandwidth/file size. I don’t know if mysql can backup differently. If it was an MS SQL or Oracle I would do a differential backup per day and one full per week (probably, but that… 
- 
		0 votes4 answers1443 viewsA: SQL query that meets a parameter that is a setFirst you must create a table of diseases and another of symptoms and then one of relationship between diseases and symptoms. For appointments you should do something pareciso, one of consultations… 
- 
		2 votes8 answers4914 viewsA: Do not allow saving image of a web pageSuperimpose an invisible div on the image, when trying to click on the image the user will be clicking on the div. But look at Sergio’s answer, he’s right. 
- 
		5 votes5 answers29661 viewsA: How do I know if a column exists in an SQL Server table?Try this, works for aSQL Server 2008+ and changes little to previous versions. if exists( select * from sys.sysobjects so join sys.syscolumns sc on sc.id = so.id where so.xtype = N'U' and so.name…