Posts by Ilyes • 244 points
13 posts
-
0
votes2
answers644
viewsA: How to include data from a multi-line query in a memo using Delphi?
You are using the data type BIGINT instead of the data type INT, as the maximum value of INT is 2.147.483.647, you can consult the on-line documents[1] here to see. Also consider using parameters to…
-
3
votes2
answers161
viewsA: Update in three tables
You have two options to do this (in addition to what is already given by @José Diz): OUTPUT clause. TRIGGERS. Here is an example with OUTPUT clause CREATE TABLE BooksA( BookID INT, BookPrice MONEY…
-
0
votes4
answers3071
viewsA: If condition in Where SQL Server
You can do it as follows SELECT * FROM tabela WHERE (Data >= @dataInicial AND Data <= @datafim) OR (@dataInicial IS NULL AND Data <= @datafim);…
-
0
votes2
answers51
viewsA: Search for elements with a certain distance of time (informing only time)
You can use the function LAG () if you are working on the 2012+ version next to the function DATEDIFF() CREATE TABLE T( ID INT, Data DATETIME ); INSERT INTO T VALUES (1, '09-11-2018 19:01:10'), (2,…
-
0
votes2
answers597
viewsA: Join column data online - SQL Server
You can use the STUFF () with FOR XML PATH CREATE TABLE T( [User] VARCHAR(45), Phone VARCHAR(45) ); INSERT INTO T VALUES ('Usuario_A', 'telefone1'), ('Usuario_A', 'telefone2'), ('Usuario_A',…
-
0
votes2
answers700
viewsA: Query with Left Join without returning duplicate value
Since you did not provide sample data and expected result, just for fun I propose this example to give a hint on how to achieve this using the function STUFF() CREATE TABLE Teachers ( TeacherID INT…
-
0
votes3
answers923
viewsA: Focus item on Listbox with Delphi
Try the following uses System.StrUtils, ... procedure TForm1.FormCreate(Sender: TObject); begin with ListBox1.Items do begin Add('Good morning!'); Add('Hi, welcome to StackOverflow'); Add('Foo…
-
1
votes2
answers330
viewsA: Topenpicturedialog does not take the path from the Images folder
Try this: uses ... System.Types, System.IOUtils; ... ... procedure TForm1.Button1Click(Sender: TObject); Var Dlg: TOpenPictureDialog; begin Dlg := TOpenPictureDialog.Create(Self); try with Dlg do…
-
0
votes2
answers801
viewsA: update sql relating a column with external value
I think you’re looking for inner join: SELECT T2.Nome, T1.Codigo FROM Table1 T1 INNER JOIN Table2 T2 ON T1.ID = T2.ID WHERE --outras condições To insert the excel file data: SELECT * INTO nome do…
-
0
votes1
answer232
viewsA: Return a Result set from a Mysql storeProcedure
If the stored procedure returns a cursor to be used with visual data controls, add a data source component to the data module and define its Dataset property as the data set of the stored procedure…
-
2
votes2
answers229
viewsA: How to use the WHERE clause on top of a column made from row_number() over()
You can also use a sub-base: SELECT seq, colA, colB FROM ( SELECT *, ROW_NUMBER() OVER (PARTITION BY colA ORDER BY colB) AS Seq FROM tabA ) AS T WHERE T.Seq BETWEEN 1 AND 5;…
-
0
votes1
answer392
viewsA: Check if record already exists in DB Grid Delphi
If you have a primary key, the database will prevent you from entering that key again, and the application will launch a "Primary key breach" error, if you really want to search the table when the…
-
1
votes3
answers488
viewsA: Using Datetimepicker with Time
Drop a TDateTimePicker and a TEdit in the form and then write the event handlers as follows: type TForm1 = class(TForm) DateTimePicker1: TDateTimePicker; Edit1: TEdit; procedure…