[Solved] Microsoft SQL Server: how to put together these three tables? [closed]

Join the tables, concatenate the strings and use LIKE to look for the “certain text”. SELECT p.path + ‘\’ + d.filename FROM documents d INNER JOIN documentsinprojects dp ON dp.documentid = d.documentid INNER JOIN projects p ON p.projectid = dp.projectid WHERE p.path LIKE ‘%certain text%’ AND d.filename LIKE ‘%certain text%’; 4 solved Microsoft SQL Server: … Read more

[Solved] This procedure not working

The problem is not at the procedure it is at the calling. When you call the stored procedure, you need to declare and pass in the required parameter declare @NAME VARCHAR(50), @CITY VARCHAR(200), @MOBILE NUMERIC(20) execute GETDETAIL @AGE = 21, @NAME = @NAME OUTPUT, @CITY = @CITY OUTPUT, @MOBILE = @MOBILE OUTPUT SELECT @NAME, @CITY, … Read more

[Solved] Getting error “Incorrect syntax near ‘,'”

You are appending mainmenu.tbxSelected whereas I suspect that your intention was to append mainmenu.tbxSelected.Text The former would probably result in a fully qualified typename in your WHERE clause, which would contain commas. As an aside, you should be aware that constructing SQL in this way leaves you potentially open to SQL Injection attacks. If that’s … Read more

[Solved] SQL Server Char/VarChar DateTime Error [closed]

This should look more like this: DateTime now = DateTime.Now; DateTime after1month = DateTime.Now.AddMonths(1); SqlCommand cmd = new SqlCommand(“SELECT * FROM TABLE WHERE THEDATE BETWEEN @now AND @after1month”, connection); cmd.Parameters.Add(new SqlParameter(“@now”, System.Data.SqlDbType.DateTime).Value = now); cmd.Parameters.Add(new SqlParameter(“@after1month”, System.Data.SqlDbType.DateTime).Value = after1month); Sometimes you can do it directly on SQL Server side using query: SELECT * FROM TABLE … Read more