a) checks a table to find names of other tables that need to be created b) check if that table already exists c) if not, create it d) fill her up with new data Now, this all works fine up to the part that has to check whether the table exists: set @NewTablename = (select […]
I am storing the various activities with id’s as 1,2,3,4 consecutively. If I delete the 2nd record (id 2), how can I update so that 3 becomes 2 and 4 becomes 3? Thanks in advance
In our case we have some business logic that looks into several tables in a certain order, so that the first non null value from one table is used. While the look up is not hard, but it does take several lines of SQL code to accomplish. I have read about scalar valued functions in […]
I would like to declare a variable ‘XMLOutput’ and have it produce the contents of a table in XML format. If you could provide a really simple example I could work off of I would really appreciate it. I tried using the xmlelement() but could not get it to work.
What is the difference between scalar-valued, table-valued, and aggregate functions in SQL server? And does calling them from a query need a different method, or do we call them in the same way?
which is better, is there any performance difference? setting datetime column’s default value to getdate() or using getdate() with the insert t-sql script.
Possible Duplicate: Select Records multiple times from table I want to have my query return (multiple) rows for the value of TABLE_B.QTY. TABLE A SALESNR ITEMNR LINENR 100 B2001 1 101 B2002 2 102 A1021 3 TABLE B LINENR COLOR QTY 1 WHITE 3 2 BLACK 1 3 BROWN 8 For instance, with the following […]
I have the following records inside my table ID StudentID Semester Grade 1 1 First 100 2 1 Second 90 3 2 First 90 4 1 Third 85 I want to combine all the records of Student ID 1 in one record StudentID First Second Third 1 100 90 85 2 90 null null Any […]
Is there a function in TSql that indicates whether the previous query returned any results.
CREATE PROCEDURE dbo.InsertInboxMessage @UserID uniqueIdentifier @Message nvarchar(Max) AS INSERT INTO Messages(UsersID, Messages) VALUES(@UserID, @Message) It tells me that I have an error near @Message and that I must declare the scalar @UserID. How do I correct those errors?