I am trying to create some tables within a database, however the tables are not appearing in my object explorer view. my code is as follows: I looked this up before posting and found this exact question: Creating table with T-SQL – can’t see created tables in Object explorer However, he was using …
Tag: sql-server
T-SQL Dollar Sign In Expressions
In this answer, there is a trick which allows to use the ROW_NUMBER() windowed function with a ‘constant’ in the ORDER BY clause: After some search in Google, I can’t find what dollar sign means in this context? I’ve tried to execute a simple query: And it returns 0. Could somebody exp…
How to summarize a query separating with commas
I have a list of dates with folios, one folio can have multiple dates. The folio is the employee holiday request folio. (SQL Server 2008) Instead of showing that info like a list I need to show it in the following format: Here is the SQL Fiddle: http://sqlfiddle.com/#!3/0ddd2/7 Answer Larry’s answer is …
Unioning overlapping time ranges, then summing the total time
I have a hardware group and many devices into this group. Example: All devices are monitored using ping. When some device is not working the program add a row into a table saying the start of break. When the device back on then the program update this row saying the end of break. It’s ok to know the tot…
Catch SQL RaiseError in jsp
I am developing a database and some JSP Pages to perform CRUD operations on it. I cannot catch exceptions related to my SQL Code in my JSP Code. For Example: I have this part of code where I raise an error in T-SQL: I need to call the function where I raise those errors in JSP code. Heres a part
Can’t retrieve data from SqlDataReader in C#
I need to insert values into several tables first I have to retrieve university id from table college and then insert faculty name into table faculty and get generated by SQL Server ID. After all of this I have to insert both ids into an other table. Problem is that I have to close readers and after I do it
SSMS Intellisense is not consistent
I have a problem with my SSMS. For every 5 minutes of interval Intellisense is not working. Is there something wrong with my SSMS software or something wrong with the local server. I won’t say it is …
How to migrate data from MongoDB to SQL-Server? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago. Improve this question I searched around I found that there are ways to transfer/sync data from s…
How to use WHILE LOOP to add value to list with condition, SQL Server 2008
I have a loop query with scenario below: orderqty = increase value 1 each loop runningstock = decrease value 1 each loop allocateqty = case when orderqty > 0 and runningstock > 0 then 1 else 0 loop till runningstock=0 or total allocation=stockqty Query: Result: the correct one should be like this: Answe…
How to see if date is in current month SQL Server?
I have a Ticket_Date column that is in the format YYYY-MM-DD HH:MI:SS I want to check if the Ticket_date is in the current month. So far I have : Ticket_date >= ‘2015-04-01’ and Ticket_date